[ruby-talk:444016] [ANN] Opal 1.6.0 and Opal-RSpec 1.0.0 released

Opal 1.6.0 and Opal-RSpec 1.0.0 have been released!

* home: https://opalrb.com/
* github: GitHub - opal/opal: Ruby ♥︎ JavaScript
* 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&gt;, or ports of known JavaScript libraries <Opal: Ruby ♥︎ JavaScript) 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/&gt;, 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 <Opal: Ruby ♥︎ JavaScript, or get started instantly with no further steps required (except for installing Ruby):

 gem install opal
 \# Try either of the following examples:
 opal \-e &#39;puts &quot;Hello world\!&quot;&#39;
 opal \-ce &#39;puts &quot;Hello world\!&quot;&#39; &gt; hello\_world\.js
 node hello\_world\.js opal \-OcEe &#39;puts &quot;Hello world\!&quot;&#39;
 \# Or run it in a web browser:
 bundle init
 bundle add opal\-browser puma
 bundle add rack \-v &#39;&lt; 3&#39;
 bundle exec opal \-Rserver \-qopal\-browser \-rbrowser \-e &#39;$document\.write\(&quot;Hello world\!&quot;\)&#39;

Read more release notes on: Opal 1.6 and Opal-RSpec 1.0

Full changelog:

Changed

* No longer truncate stacktraces to 15 lines (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* Mark async/await as non-experimental (#2477
<https://github.com/opal/opal/pull/2477&gt;\)

Performance

* Improve method block performance for runtime (#2449
<https://github.com/opal/opal/pull/2449&gt;\)
* Uninline non-typical argument handling (#2419
<https://github.com/opal/opal/pull/2419&gt;\)
* Logic optimization of runtime.js (#2415
<https://github.com/opal/opal/pull/2415&gt;\)
* Windows support for |performance:compare| CI check (#2450
<https://github.com/opal/opal/pull/2450&gt;\)
* Improve block performance for even more cases (#2465
<https://github.com/opal/opal/pull/2465&gt;\)

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&gt;\)
* Support exit in Chrome CLI Runner, both sync and async (#2439
<https://github.com/opal/opal/pull/2439&gt;\)
* Make sure the Server CLI Runner can pick up changes in sources
(#2436 <https://github.com/opal/opal/pull/2436&gt;\)
* Delegate and ruby2_keywords (#2446
<https://github.com/opal/opal/pull/2446&gt;\)
* 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&gt;\)
* Added |Kernel#caller_locations| (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* |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&gt;\)

Fixed

* Closure tracking support fixes a whole array of bugs handling

break> / |next| / |retry| / … (#2357

<https://github.com/opal/opal/pull/2357&gt;\)
* Fix an edge case of if in the most complex form not returning (#2433
<https://github.com/opal/opal/pull/2433&gt;\)
* |String#length| is now available when using |opal/mini| (#2438
<https://github.com/opal/opal/pull/2438&gt;\)
* Auto-await produced invalid code (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* Fix |Enumerable#collect_concat| and |#flat_map| implementation
(#2440 <https://github.com/opal/opal/pull/2440&gt;\)
* Improved await support for PromiseV1 (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* Compilation error occurs while compiling |being/end| returning a

case/when| (#2459 <https://github.com/opal/opal/pull/2459&gt;\)

* Ensure UTF-8 encoding of |.sourcesContent| of source maps (#2451
<https://github.com/opal/opal/pull/2451&gt;\)
* Benchmarks require string/unpack (#2453
<https://github.com/opal/opal/pull/2453&gt;\)
* Fix compilation of a call: |gets&.chomp| (#2473
<https://github.com/opal/opal/pull/2473&gt;\)
* Fix specs on Windows (#2460 <https://github.com/opal/opal/pull/2460&gt;\)
* Make opal CLI tool work again with pipes (#2474
<https://github.com/opal/opal/pull/2474&gt;\)

Internal

* GitHub Workflows security hardening (#2432
<https://github.com/opal/opal/pull/2432&gt;\)
* Retry if file cache write operation exits with Zlib::BufError (#2463
<https://github.com/opal/opal/pull/2463&gt;\)
* Eliminate redundant |var constructor| in |allocate_class| (#2452
<https://github.com/opal/opal/pull/2452&gt;\)
* Fix |performance:compare| asset size calculation (#2457
<https://github.com/opal/opal/pull/2457&gt;\)
* Fix a few specs after the Opal RSpec 1.0 (alpha) release (#2471, #2472)

···

______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

1 Like

Awesome!

In RubyConf 2022’s opening keynote, Matz mentioned that it would be a good goal to aim at replacing JavaScript in the browser with Ruby on Wasm! Opal accomplishes that goal similarly!

It’s great that Matz is indirectly on board with the idea behind Opal too!

Andy

···

On Nov 29, 2022, at 2:06 PM, hmdne <hmdne@airmail.cc> wrote:

Opal 1.6.0 and Opal-RSpec 1.0.0 have been released!

* home: https://opalrb.com/
* github: GitHub - opal/opal: Ruby ♥︎ JavaScript
* 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&gt;, or ports of known JavaScript libraries <Opal: Ruby ♥︎ JavaScript) 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/&gt;, 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 <Opal: Ruby ♥︎ JavaScript, 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: Opal 1.6 and Opal-RSpec 1.0

Full changelog:

Changed

* No longer truncate stacktraces to 15 lines (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* Mark async/await as non-experimental (#2477
<https://github.com/opal/opal/pull/2477&gt;\)

Performance

* Improve method block performance for runtime (#2449
<https://github.com/opal/opal/pull/2449&gt;\)
* Uninline non-typical argument handling (#2419
<https://github.com/opal/opal/pull/2419&gt;\)
* Logic optimization of runtime.js (#2415
<https://github.com/opal/opal/pull/2415&gt;\)
* Windows support for |performance:compare| CI check (#2450
<https://github.com/opal/opal/pull/2450&gt;\)
* Improve block performance for even more cases (#2465
<https://github.com/opal/opal/pull/2465&gt;\)

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&gt;\)
* Support exit in Chrome CLI Runner, both sync and async (#2439
<https://github.com/opal/opal/pull/2439&gt;\)
* Make sure the Server CLI Runner can pick up changes in sources
   (#2436 <https://github.com/opal/opal/pull/2436&gt;\)
* Delegate and ruby2_keywords (#2446
<https://github.com/opal/opal/pull/2446&gt;\)
* 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&gt;\)
* Added |Kernel#caller_locations| (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* |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&gt;\)

Fixed

* Closure tracking support fixes a whole array of bugs handling
>break> / |next| / |retry| / … (#2357
<https://github.com/opal/opal/pull/2357&gt;\)
* Fix an edge case of if in the most complex form not returning (#2433
<https://github.com/opal/opal/pull/2433&gt;\)
* |String#length| is now available when using |opal/mini| (#2438
<https://github.com/opal/opal/pull/2438&gt;\)
* Auto-await produced invalid code (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* Fix |Enumerable#collect_concat| and |#flat_map| implementation
   (#2440 <https://github.com/opal/opal/pull/2440&gt;\)
* Improved await support for PromiseV1 (#2440
<https://github.com/opal/opal/pull/2440&gt;\)
* Compilation error occurs while compiling |being/end| returning a
>case/when| (#2459 <https://github.com/opal/opal/pull/2459&gt;\)
* Ensure UTF-8 encoding of |.sourcesContent| of source maps (#2451
<https://github.com/opal/opal/pull/2451&gt;\)
* Benchmarks require string/unpack (#2453
<https://github.com/opal/opal/pull/2453&gt;\)
* Fix compilation of a call: |gets&.chomp| (#2473
<https://github.com/opal/opal/pull/2473&gt;\)
* Fix specs on Windows (#2460 <https://github.com/opal/opal/pull/2460&gt;\)
* Make opal CLI tool work again with pipes (#2474
<https://github.com/opal/opal/pull/2474&gt;\)

Internal

* GitHub Workflows security hardening (#2432
<https://github.com/opal/opal/pull/2432&gt;\)
* Retry if file cache write operation exits with Zlib::BufError (#2463
<https://github.com/opal/opal/pull/2463&gt;\)
* Eliminate redundant |var constructor| in |allocate_class| (#2452
<https://github.com/opal/opal/pull/2452&gt;\)
* Fix |performance:compare| asset size calculation (#2457
<https://github.com/opal/opal/pull/2457&gt;\)
* Fix a few specs after the Opal RSpec 1.0 (alpha) release (#2471, #2472)

______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

Thanks :smiley:

Opal is staying there, anyway, as an alternative browser Ruby implementation (like JRuby is for MRI on desktops and servers) and we will aim to produce compatible APIs, so we can have libraries that will work in both environments.

And yes, writing browser code in Ruby is indeed great! You can at times forget that you are in a browser. Let's hope our efforts will popularize this approach.

···

On 11/29/22 21:58, Andy Maleh wrote:

Awesome!

In RubyConf 2022’s opening keynote, Matz mentioned that it would be a good goal to aim at replacing JavaScript in the browser with Ruby on Wasm! Opal accomplishes that goal similarly!

It’s great that Matz is indirectly on board with the idea behind Opal too!

Andy

______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

1 Like