rusty_racer 0.2.4 → 0.2.6

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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RustyRacer
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.6"
5
5
  end
data/lib/rusty_racer.rb CHANGED
@@ -121,7 +121,7 @@ module RustyRacer
121
121
  # `timeout_ms` (0 = the isolate default) caps this eval; `filename` names the
122
122
  # script in stack traces and parse-error locations.
123
123
  def eval(source, timeout_ms: 0, filename: '<eval>')
124
- _eval(source, timeout_ms, filename, false)
124
+ _eval(source, timeout_ms, filename, 0)
125
125
  end
126
126
 
127
127
  # Run `source` for its EFFECT and return nil, without marshalling its
@@ -132,7 +132,14 @@ module RustyRacer
132
132
  # whose writes all landed. `globalThis.win = someProxy` is the shape that
133
133
  # bites.
134
134
  def eval_void(source, timeout_ms: 0, filename: '<eval>')
135
- _eval(source, timeout_ms, filename, true)
135
+ _eval(source, timeout_ms, filename, 1)
136
+ end
137
+
138
+ # Run `source` and return its completion value only where it is a primitive — a string, a number, a boolean, a
139
+ # BigInt, null — and nil for an object or a symbol, which is never walked: for a caller that wants a string of it
140
+ # (a javascript: URL's evaluation), whatever object the source happens to end with.
141
+ def eval_primitive(source, timeout_ms: 0, filename: '<eval>')
142
+ _eval(source, timeout_ms, filename, 2)
136
143
  end
137
144
 
138
145
  # Compile a classic <script>; returns a RustyRacer::Script to #run.
@@ -171,6 +178,15 @@ module RustyRacer
171
178
  self
172
179
  end
173
180
 
181
+ # Evaluate the instantiated module. Its evaluation's rejection — a top-level throw, a top-level await's — raises
182
+ # (RustyRacer::RuntimeError, as far as the drain after it settles), or, `report:` naming a function of its context's
183
+ # global, is that function's to report: called with the rejection's reason — a top-level throw's before this
184
+ # returns, a top-level await's as it settles — and nothing raised (HTML "run a module script": upon rejection,
185
+ # report the exception).
186
+ def evaluate(report: nil)
187
+ _evaluate(report&.to_s)
188
+ end
189
+
174
190
  # The V8 module status: :uninstantiated, :instantiating, :instantiated,
175
191
  # :evaluating, :evaluated or :errored.
176
192
  def status
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rusty_racer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-28 00:00:00.000000000 Z
11
+ date: 2026-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -34,6 +34,7 @@ extensions:
34
34
  - ext/rusty_racer/extconf.rb
35
35
  extra_rdoc_files: []
36
36
  files:
37
+ - CHANGELOG.md
37
38
  - Cargo.toml
38
39
  - README.md
39
40
  - ext/rusty_racer/Cargo.lock