rusty_racer 0.2.3 → 0.2.5
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 +4 -4
- data/README.md +18 -1
- data/ext/rusty_racer/Cargo.toml +6 -2
- data/ext/rusty_racer/src/lib.rs +612 -145
- data/ext/rusty_racer/src/ops.rs +153 -98
- data/lib/rusty_racer/version.rb +1 -1
- data/lib/rusty_racer.rb +34 -9
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 488967c6324cc118d0cf37974c23566725c7c6ce14ba48572330075d1b2dff66
|
|
4
|
+
data.tar.gz: 48f562d20d1217e91a9727d1fa348312c51c49b9f82607f3bd2803247e76976c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: faad4323b59c0eca2d69f66bb9698a41ab5837c0f417710b0f125ca39c0fad22e3d399f8fe730bd2c526a1e9cfe34ad9b8c8be5fdbc47b5c8a6e860eb23308f7
|
|
7
|
+
data.tar.gz: 304a7388700465fcfc86a8e7ffeba87c9bd95455075bce889277abe44193f8f407326a136cfe0be39738d53061603d249f153f031866c9570bddec424ac5b807
|
data/README.md
CHANGED
|
@@ -93,6 +93,8 @@ ran to completion. When the value is incidental, say so: `#eval_void`,
|
|
|
93
93
|
result. A statement list has a completion value whether you want one or not, so
|
|
94
94
|
plumbing an object into a global (`globalThis.win = someProxy`) is enough to
|
|
95
95
|
make a plain `#eval` fail after every one of its writes has landed.
|
|
96
|
+
`#eval_primitive` sits between the two: it returns the completion value only
|
|
97
|
+
where it is a primitive, and nil for an object or a symbol, which it never reads.
|
|
96
98
|
|
|
97
99
|
ES modules (the embedder owns the URL→module registry):
|
|
98
100
|
|
|
@@ -114,6 +116,12 @@ loop here (see below), a `true` graph whose `await` never settles returns from
|
|
|
114
116
|
`evaluate` with the module body still suspended, and `status` reports
|
|
115
117
|
`:evaluated` either way — so `graph_async?` is what distinguishes the two.
|
|
116
118
|
|
|
119
|
+
A rejected evaluation — a top-level throw, or a top-level `await` that rejects —
|
|
120
|
+
raises from `evaluate`. Pass `report:` the name of a function on the context's
|
|
121
|
+
global to have it called with the reason instead (HTML's "report the
|
|
122
|
+
exception"), at once for a throw and as it settles for an `await`:
|
|
123
|
+
`app.evaluate(report: "reportError")`.
|
|
124
|
+
|
|
117
125
|
Classic `<script>`s work the same way: `ctx.compile("1 + 1").run` # => 2.
|
|
118
126
|
|
|
119
127
|
### Resource limits
|
|
@@ -203,6 +211,12 @@ Also available:
|
|
|
203
211
|
`microtasks: :auto` also drains at the end of each outermost eval/call/evaluate;
|
|
204
212
|
`microtasks: :explicit` leaves it fully manual. There is no event loop or timers
|
|
205
213
|
either way.
|
|
214
|
+
- **`Isolate#pump_message_loop`** — runs the tasks V8 posts instead of running
|
|
215
|
+
inline, most visibly `FinalizationRegistry` cleanup callbacks: a microtask
|
|
216
|
+
checkpoint never runs them, so without a pump a collected target's callback
|
|
217
|
+
never fires. It drains every pending task without blocking, then a microtask
|
|
218
|
+
checkpoint; with nothing pending it is a no-op. The callbacks are ordinary JS,
|
|
219
|
+
so the pump is capped by `timeout_ms` like an `eval`.
|
|
206
220
|
- **`Isolate#terminate`**, **`Isolate#dynamic_import_resolver=`**,
|
|
207
221
|
**`Context#reset`** (below), and **`Platform.set_flags!`**.
|
|
208
222
|
|
|
@@ -217,7 +231,10 @@ warm isolate — a per-visit reset that avoids rebuilding the VM. Its contract:
|
|
|
217
231
|
(or to an empty realm, with no snapshot).
|
|
218
232
|
- **Runtime mutations are dropped.** Anything set on the realm at runtime is gone.
|
|
219
233
|
- **Host fns are dropped.** Functions `attach`/`attach_many`'d into the realm are
|
|
220
|
-
released
|
|
234
|
+
released — the isolate stops holding them, so whatever they captured becomes
|
|
235
|
+
collectable; re-attach them after a reset. One the embedder kept hold of (through
|
|
236
|
+
another realm, say) throws `unknown host function` when called; it never runs
|
|
237
|
+
what was attached after it.
|
|
221
238
|
- **Modules and classic scripts are dropped.** Handles compiled in the realm die
|
|
222
239
|
with the old context.
|
|
223
240
|
- **The realm id and the shared same-origin token are preserved** — the id keeps
|
data/ext/rusty_racer/Cargo.toml
CHANGED
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
# links and loads with no custom archive.
|
|
6
6
|
[package]
|
|
7
7
|
name = "rusty_racer"
|
|
8
|
-
version = "0.2.
|
|
8
|
+
version = "0.2.5"
|
|
9
9
|
edition = "2024"
|
|
10
10
|
publish = false
|
|
11
11
|
|
|
12
|
+
# cdylib: the standalone gem extension (.so Ruby loads directly).
|
|
13
|
+
# lib (rlib): lets an embedder link rusty_racer as a Rust library and build its
|
|
14
|
+
# own cdylib — capybara-simulated links rusty_racer + a native DOM into one
|
|
15
|
+
# extension and calls rusty_racer::install_classes from its own magnus init.
|
|
12
16
|
[lib]
|
|
13
|
-
crate-type = ["cdylib"]
|
|
17
|
+
crate-type = ["lib", "cdylib"]
|
|
14
18
|
|
|
15
19
|
[dependencies]
|
|
16
20
|
# rb-sys: exposes magnus::rb_sys (protect — catch a Ruby raise from a host
|