Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Mitch VanDuyn
@catmando
@elia okay I will drege up my fork of that, dust it off, and get it out there.
# hyper-spec dependencies
  spec.add_dependency 'capybara'
  spec.add_dependency 'chromedriver-helper', '1.2.0'
  spec.add_dependency 'libv8', '~> 6.7.0'
  spec.add_dependency 'method_source'
  spec.add_dependency 'mini_racer', '~> 0.2.4'
  spec.add_dependency 'opal', '>= 0.11.0', '< 0.12.0'
  spec.add_dependency 'parser', '>= 2.3.3.1'
  spec.add_dependency 'pry'  # this should be removed
  spec.add_dependency 'rspec-rails'
  spec.add_dependency 'selenium-webdriver'
  spec.add_dependency 'timecop', '~> 0.8.1'
  spec.add_dependency 'uglifier'
  spec.add_dependency 'unparser', '>= 0.4.2' # 0.4 is incompatible
  spec.add_dependency 'webdrivers'
Elia Schito
@elia
@catmando that’s great! Thanks!
Bernhard Weichel
@bwl21
Uh
Elia Schito
@elia
@/all I've just released opal-rails v1.0.0.rc1 I'd love to have someone try it out on real applications and let me know if there's any issue
I'll release the final version next week
Jose Añasco
@merongivian
awesome!
Jose Añasco
@merongivian
hey @janbiedermann i was giving opal_webpack_loader a try on a bare new rails app but it seems that is not loading opal_loader.rb (though webpack is compiling it). Do i need to load any specific file before loading rails?
Jan Biedermann
@janbiedermann
@merongivian do you use webpacker or only webpack?
Jose Añasco
@merongivian
@janbiedermann only webpack
Jan Biedermann
@janbiedermann
then to get the asset loaded you need to use the owl_script_tag in your view, do you?
Jose Añasco
@merongivian
yea, i'm seeing right README right now and it says that i need to use owl_script_tag he, should have read it more thoroughly, thanks :)
Jan Biedermann
@janbiedermann
@merongivian Not your fault, the rails installation doc doesnt mention it. I added a note to the rails doc to point to the view helper section. Thanks for bringing it up.
Bernhard Weichel
@bwl21

HI, I tried with opal 1.0 today again. I get JS code like this

/* Generated by Opal 1.0.0 */
Opal.modules["nodejs/open-uri"] = function(Opal) {
  var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module;

  return (function($base, $parent_nesting) {
    var self = $module($base, 'OpenURI');

    var $nesting = [self].concat($parent_nesting), $OpenURI_request$1, $OpenURI_data$2;
    if (self.__xmlhttprequest__ == null) self.__xmlhttprequest__ = nil;


    self.__xmlhttprequest__ = require('unxhr');
    var __XMLHttpRequest__ = self.__xmlhttprequest__.XMLHttpRequest;
    Opal.defs(self, '$request', $OpenURI_request$1 = function $$request(uri) {
      var self = this;

which subesequently fail in browserify with Error: Cannot find module 'unxhr'

Is there something changed with respect to nodejs?

Guillaume Grossetie
@Mogztter
unxhr is a "polyfill" of XMLHttpRequest for Node.js
maybe you need to install this dependency?
but if you are running in a browser environment you shouldn't need this library
Bernhard Weichel
@bwl21
@Mogztter I am creating a cli program which runs with node. I wonder if it was there with opal 0.14?
Guillaume Grossetie
@Mogztter
it's a recent change but it was introduces in 0.11 something I think
v1.0.0 v1.0.0.beta1
it replaces xmlhttprequest
Bernhard Weichel
@bwl21
when I compile with 0.11.4 it does not appear in the resulting js file.
I see in Opal 1.0 there is a new module opal/open-uri which does not come with 0.11.4.
Bernhard Weichel
@bwl21
I could find /Users/beweiche/.rvm/gems/ruby-2.4.1/gems/opal-1.0.0/stdlib/nodejs/node_modules/unxhr so it is on my machine. Question is, why It is not found by browserify?
of course it is another story, If I should move from broweserify to webpack
I am using browserify, since I want a single JS file which I can run without installation in node
Bernhard Weichel
@bwl21
as a pity, my app is 25% slower in opal 1.0 compared to 0.11.4
but I would keep track with Opal despite of the performance issue. So I would appreciate any hint how to overcome the issue with unxhr
Jan Biedermann
@janbiedermann
webpack does that too, bundle one file with all dependencies. I use this to bundle assets for server side rendering in node. webpack uses 'use "strict"' by default for all modules, this may be the cause for the performance difference you see, that 'use "strict"' is not used by your browserify bundle, but i am not sure.
Jan Biedermann
@janbiedermann
(well, 'use "strict"' is used by webpack by default when bundling opal with opal-webpack-loader and the es6_modules_1_1 PR/branch)
Guillaume Grossetie
@Mogztter
@bwl21 you should probably exclude the new module if you don't need it
otherwise you will need to do npm i unxhr
Bernhard Weichel
@bwl21
thanks, I installed unxhr as I don't know, how to exclude the module :-(
Now got stuck with uglifyjs which claims
Bernhards-MBP-3:src beweiche$ uglifyjs -c -m -o zupfnoter-cli.min.js zupfnoter-cli.js
Parse error at zupfnoter-cli.js:13970,0
const Url = require('url')
It seems that uglifyjs does not support ES6 ..
Jan Biedermann
@janbiedermann
it does, there must be 'harmony' flag or something
Bernhard Weichel
@bwl21
@janbiedermann thanks for the hint. I had to do
npm install --save uglify-js@github:mishoo/UglifyJS2#harmony
Bernhard Weichel
@bwl21
@janbiedermann you mentioned "strict" ... Does it influence perfomance.? Can I control it by Opal options?
Jan Biedermann
@janbiedermann
@bwl21 yes, use "strict" does influence performance. opal as of 1.0 does not have a option to enable strict mode, because strict mode also has different behaviour in some cases for which opal has to adopt. This is wip.
However, if you use opal-webpack-loader with the es6 module branch (opal/opal#1976), every opal module is bundled in strict mode, which is just a property of webpack es6 modules, they are in strict mode by default.
As for the performance difference here are some benchmarks (nodejs vs strictnodejs, scroll the table to the left, see 3 vs 4): https://github.com/opal/opal/pull/1973#issuecomment-490621181
PR#1976 provides some adaptions to strict mode, but there are still some differences in bahaviour to non strict Opal 1.0
usually it works very well :)
Jan Biedermann
@janbiedermann
If you run your code in node, i can recommend using the latest node in terms of performance.
Jose Añasco
@merongivian
@janbiedermann hey!, im trying to use sass instead of css with opal-webpack-loader, but im getting this error:
 Invalid CSS after "": expected 1 selector or at-rule, was "var content = requi"
Jan Biedermann
@janbiedermann
hi @merongivian , that error looks a bit incomplete to me, or is it that way?
can you push your config and the files that make trouble somewhere?
Elia Schito
@elia
@/all Just released opal-rails v1.0.0 with some minor fixes from the beta