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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a799692e0bcc6c18bbba590786cd92b0f3cd5c05c65be4da085ec3a739ae2ee
4
- data.tar.gz: 0ca41e25987f9f721437abbfc1278c43d7aa688c996a1824cb342d4b1672ed70
3
+ metadata.gz: 488967c6324cc118d0cf37974c23566725c7c6ce14ba48572330075d1b2dff66
4
+ data.tar.gz: 48f562d20d1217e91a9727d1fa348312c51c49b9f82607f3bd2803247e76976c
5
5
  SHA512:
6
- metadata.gz: c63a41df38fbacdfc440a4bb61ff8f780315d2ce267a55d698505a7601557ba76a3762896dd12a4989aaf34d27ba2a7eb9c751a7249e7a71ae572a37d5af6133
7
- data.tar.gz: e8deb0c3a86b25577996ee84d15f2163f6a2a8eab952d3c8592e4513f6e2cb483f3734ec7947dff22bad19cea9c5239284edd910473058baea5761921c510b8f
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 (their GC roots freed); re-attach them after a reset.
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
@@ -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.3"
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