Opal 1.6.0 and Opal-RSpec 1.0.0 have been released!
* home:
https://opalrb.com/
* github:
https://github.com/opal/opal
* chat:
https://slack.opalrb.com/
Opal is a Ruby (3.1) to JavaScript (ES5) compiler allowing you to write
frontend code in pure Ruby and have it translated to clean and efficient
JavaScript. It also includes a highly compatible core library that
includes all the methods you've come to love. All this with a robust
support of source maps, so you can debug Ruby code, not JavaScript in
your Web Console. It can be used both to create websites entirely in
Ruby (using Opal-Browser <https://github.com/opal/opal-browser>, or
ports of known JavaScript libraries <https://opalrb.com/libraries/>) and
to port existing Ruby libraries to JavaScript, to be ran both in Node.JS
and in web browsers (and other JavaScript environments).
Opal-RSpec is an Opal port of RSpec <https://rspec.info/>, a well known
Ruby testing tool, allowing you to easily test your Ruby applications in
browser and in Node, just like you can do so with MRI.
This release of Opal is focused primarily on improving upon MRI
compatibility. We now fully support freezing and also we now have a new
robust and hackable control flow instruction handling implementation
(think: `break`, `next`, `return`...). Also, Windows support has been
improved and Opal gained a parallel compile support - significantly
improving compile times on multicore systems. In addition, the `await`
subsystem is no longer experimental.
Try it now on <https://opalrb.com/try>, or get started instantly with no
further steps required (except for installing Ruby):
gem install opal
# Try either of the following examples:
opal -e 'puts "Hello world!"'
opal -ce 'puts "Hello world!"' > hello_world.js
node hello_world.js opal -OcEe 'puts "Hello world!"'
# Or run it in a web browser:
bundle init
bundle add opal-browser puma
bundle add rack -v '< 3'
bundle exec opal -Rserver -qopal-browser -rbrowser -e
'$document.write("Hello world!")'
Read more release notes on:
https://opalrb.com/blog/2022/11/24/opal-1-6-opal-rspec-1-0/
Full changelog:
Changed
* No longer truncate stacktraces to 15 lines (#2440
<https://github.com/opal/opal/pull/2440>)
* Mark async/await as non-experimental (#2477
<https://github.com/opal/opal/pull/2477>)
Performance
* Improve method block performance for runtime (#2449
<https://github.com/opal/opal/pull/2449>)
* Uninline non-typical argument handling (#2419
<https://github.com/opal/opal/pull/2419>)
* Logic optimization of runtime.js (#2415
<https://github.com/opal/opal/pull/2415>)
* Windows support for |performance:compare| CI check (#2450
<https://github.com/opal/opal/pull/2450>)
* Improve block performance for even more cases (#2465
<https://github.com/opal/opal/pull/2465>)
Added
* Added support for |#freeze| and |#frozen?| (#2444, #2468)
* Add CLI support for ESM, at least for Chrome, NodeJS, QuickJS and
GJS (#2435 <https://github.com/opal/opal/pull/2435>)
* Support exit in Chrome CLI Runner, both sync and async (#2439
<https://github.com/opal/opal/pull/2439>)
* Make sure the Server CLI Runner can pick up changes in sources
(#2436 <https://github.com/opal/opal/pull/2436>)
* Delegate and ruby2_keywords (#2446
<https://github.com/opal/opal/pull/2446>)
* Source code can now be embedded in the compiled file to improve
development/debugging, e.g. RSpec reports, |Proc#source_location|
(#2440 <https://github.com/opal/opal/pull/2440>)
* Added |Kernel#caller_locations| (#2440
<https://github.com/opal/opal/pull/2440>)
* |Opal::Builder::Prefork| for blazingly fast multicore compilation
times (#2263, #2462, #2454, #2469, #2475)
* Add |Opal::BuilderProcessors::RubyERBProcessor| (#2470
<https://github.com/opal/opal/pull/2470>)
Fixed
* Closure tracking support fixes a whole array of bugs handling
|break| / |next| / |retry| / … (#2357
<https://github.com/opal/opal/pull/2357>)
* Fix an edge case of if in the most complex form not returning (#2433
<https://github.com/opal/opal/pull/2433>)
* |String#length| is now available when using |opal/mini| (#2438
<https://github.com/opal/opal/pull/2438>)
* Auto-await produced invalid code (#2440
<https://github.com/opal/opal/pull/2440>)
* Fix |Enumerable#collect_concat| and |#flat_map| implementation
(#2440 <https://github.com/opal/opal/pull/2440>)
* Improved await support for PromiseV1 (#2440
<https://github.com/opal/opal/pull/2440>)
* Compilation error occurs while compiling |being/end| returning a
|case/when| (#2459 <https://github.com/opal/opal/pull/2459>)
* Ensure UTF-8 encoding of |.sourcesContent| of source maps (#2451
<https://github.com/opal/opal/pull/2451>)
* Benchmarks require string/unpack (#2453
<https://github.com/opal/opal/pull/2453>)
* Fix compilation of a call: |gets&.chomp| (#2473
<https://github.com/opal/opal/pull/2473>)
* Fix specs on Windows (#2460 <https://github.com/opal/opal/pull/2460>)
* Make opal CLI tool work again with pipes (#2474
<https://github.com/opal/opal/pull/2474>)
Internal
* GitHub Workflows security hardening (#2432
<https://github.com/opal/opal/pull/2432>)
* Retry if file cache write operation exits with Zlib::BufError (#2463
<https://github.com/opal/opal/pull/2463>)
* Eliminate redundant |var constructor| in |allocate_class| (#2452
<https://github.com/opal/opal/pull/2452>)
* Fix |performance:compare| asset size calculation (#2457
<https://github.com/opal/opal/pull/2457>)
* Fix a few specs after the Opal RSpec 1.0 (alpha) release (#2471, #2472)