opalrb - require 'opal-jquery' gives error: A file required wasn't found

Opal looks amazing!!! I'm getting the same "A file required wasn't found" error when I try to require 'opal-jquery' on two different Windows 7 and Windows 10 systems:C:\opaltest>node --versionv10.15.3C:\opaltest>ruby -vruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]C:\opaltest>gem list -a opal*** LOCAL GEMS ***opal (0.11.4)opal-jquery (0.4.3)The file test.js.rb consists of these 3 lines:require 'opal'require 'opal-jquery'puts 'success'C:\opaltest>opal -c test.js.rb > test.jsTraceback (most recent call last): 12: ...Read more

opalrb - How to write opal library?

I want to write opal library to provide nicer interface to some native javascript I have to use. However, I have no idea where to start. I have some of the stuff wrapped in my current code, but dunno how to make it into separate "module" or what term doesn't opal use.What is common blueprint to start such a thing? Or should I just dig through opal-browser and figure it out from there?...Read more

opalrb - How can I use require_relative when compiling with Opal and subsequently running in Node?

I am totally new to Opal. I am just testing out how to use it by writing simple Ruby code in a local file, compiling it using opal -c test.rb > test.js, and then executing the resultant js file using node test.js. This is working fine when all of the code that I want is in test.rb. If, however, when test.rb has for the first line, require_relative 'other_file' and other_file.rb exists in the same directory with test.rb, then it fails when executed with node. I get an error message that begins like this:/Users/huliax/projects/scratch/opal...Read more

opalrb - is it possible to use the gatsby static site generator with reactrb?

So, I'm basically still pretty new to the whole npm/react.js (let alone react.rb) ecosystem, and I'm wondering if it would be possible to use reactrb with the gatsby static site generator.I've been attempting to get opal/reactrb support through opal-webpack, but have been running into some issues (see this issue for some backstory https://github.com/cj/opal-webpack/issues/36). Specifically where I got stuck was trying to get it to play nice with bundler.Is combining reactrb components with gatsby something that's even feasible? I'm hoping the a...Read more

opalrb - Opal file called from client via getsctipt (or xhr'ed and evaled) can't be evaled and used

I want to xhr some opal script, and use ruby code defined there. I tried to get it with $.getScript. But no success for me. $.ajax({ url: 'assets/foo.js.rb', success: function(data){ #{ClassInFooJs.new} }, dataType: "script"});Moreover the script is evaled (in strange manner), I mean I can call Opal.modules["file_i_required"] from console, and it will return basically the compiled code. BUT inside of it nothing is evaled, (no console.logs, window["foos"] = #{something}), and I can't reference anything from that file.Any help?...Read more

opalrb - Opal.rb bridged class inner mechanics

I want to know how exactly bridging to native classes does internally work. (can't find any documentation on that).function NativeClass() { this.foo = "bar"; }class MyClass <NativeClass; endIs it similar to ES6's or coffeescript's inheritance (from JS perspective)?Is it possible to define methods on function that can be called like regular ones (like:RubyClass`.prototype`.foo = function(){return RubyClass instances' @accessor}) not the.$foo`.And one more thing.If Ruby class is inheriting from native class,is it possible to reference in that ...Read more

opalrb - Are threads coming to opal?

So, I read here, that we don't have access to threads from javascript. But thats not really true, is it? We do have some sort of thread support from javascript (with workers?). It's not going to be impossible. Is this the issue or am I misunderstanding something?...Read more

OpalRB Ignore compile directive

I'm building an application that will be hosted both as a stand-alone app as well as running within the web browser. This means that certain classes should be implemented differently (but used in the same way). Example:If OPAL_RB require 'javascript_aware_lib'else require 'native_lib'endThe problem with this is, Ruby will evaluate this at run-time, but Opal will evaluate it at compile time. If this was not so, I could simply use a rescue clause:begin RUBY_ENGINE_VERSION #opal requires goes hererescue # MRI Ruby requires goes here endSo,...Read more

opalrb - How shall I migrate to opal 0.7.0.beta

I tried to upgrade to use Opal 0.7.0.beta. I want to compile to a static app and follow the steps in http://opalrb.org/docs/static_applications/My Rakefile looks like the one below. The questions:How do I need to rework the :build task to get rid of the deprecation message. i tried. to use Opal::Server instead of Opal::Environment but it did not work.I get `Opal already loaded. Loading twice can cause troubles, please fix your setup.``I get undefined is not a function in the generated javascript Opal.mark_as_loaded(Opal.normalize_loadable_path(...Read more