Releases: hmsk/quickjs.rb
v0.14.0
New features
POLYFILL_URL
New opt-in feature flag that polyfills https://developer.mozilla.org/en-US/docs/Web/API/URL and https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams:
vm = Quickjs::VM.new(features: [::Quickjs::POLYFILL_URL])
vm.eval_code('new URL("https://example.com/path?q=1").searchParams.get("q")') #=> "1"POLYFILL_CRYPTO
New opt-in feature flag that polyfills the https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API:
vm = Quickjs::VM.new(features: [::Quickjs::POLYFILL_CRYPTO])
vm.eval_code('crypto.randomUUID()')
vm.eval_code('await crypto.subtle.digest("SHA-256", new TextEncoder().encode("hello"))')Supports crypto.getRandomValues, crypto.randomUUID, and crypto.subtle (digest, generateKey, importKey, exportKey, sign, verify, deriveKey, deriveBits).
VM#call
Call a JavaScript function by name with Ruby arguments:
vm = Quickjs::VM.new
vm.eval_code('function add(a, b) { return a + b }')
vm.call('add', 1, 2) #=> 3Breaking changes
Remove deprecated VM#logs
VM#logs announced as deprecated in v0.13.0 has been removed. Use VM#on_log instead.
Maintenance
Update Intl polyfill packages
All @formatjs packages updated to their latest versions.
v0.13.0
VM#on_log
Instead of collecting logs after the fact via VM#logs, you can now register a block that fires for every console.log/info/debug/warn/error call as it happens.
vm = Quickjs::VM.new
vm.on_log { |log| puts "#{log.severity}: #{log.to_s}" }
vm.eval_code('console.warn("watch out")')
# => prints: warning: watch outEach log object exposes .severity (:info / :verbose / :warning / :error), .to_s (space-joined args), and .raw (array of Ruby values).
VM#logs is now deprecated in favor of this API (will be omitted in v0.14.0).
POLYFILL_ENCODING
New opt-in feature flag that polyfills WHATWG Encoding (TextEncoder and TextDecoderr)
vm = Quickjs::VM.new(features: [::Quickjs::POLYFILL_ENCODING])
vm.eval_code('new TextEncoder().encode("hello")')More for POLYFILL_FILE
Ruby interop for Blob and File
vm = Quickjs::VM.new(features: [::Quickjs::POLYFILL_FILE])Ruby ::File objects returned from define_function blocks are surfaced as File-compatible JS proxies, supporting .name, .size, .text(), .arrayBuffer(), and .slice(). Passing such a proxy back to Ruby from JS returns the original ::File object. JS Blob / File values returned to Ruby are converted to Quickjs::Blob / Quickjs::File structs.
vm.define_function(:get_file) { File.open('report.pdf') }
vm.eval_code("get_file().name") #=> "report.pdf"
vm.eval_code("await get_file().text()") #=> file content as StringRBS type definitions
Type signatures for the public API are now shipped with the gem and validated in CI.
v0.12.0
v0.11.2
v0.11.1
v0.11.0
Update QuickJS core to version 2025-09-13.
https://bellard.org/quickjs/Changelog
v0.10.0
Update QuickJS core to version 2025-04-26.
https://bellard.org/quickjs/Changelog
The highlights of this gem update are:
- Fixes for CVEs
- Adds column numbers in stack traces