opal

Ruby ♥︎ JavaScript

MIT License

Downloads
203
Stars
4.8K
Committers
128

Bot releases are visible (Hide)

opal -

Published by elia about 6 years ago

  • Fix bug where camelcased lvars could parse as constants
  • Add Array#shuffle
  • Migrate to Sprockets-based building
  • Move ERB to separate gem
opal -

Published by elia about 6 years ago

  • Internal cleanup
opal -

Published by elia about 6 years ago

  • Use Ruby require directive inside Sprockets
  • Depreceate Opal.process in favour of Opal::Environment
opal -

Published by elia about 6 years ago

  • Extract the JavaScript runtime to opal/runtime.js
  • Add core template.rb for the basis of template libraries for Opal
opal -

Published by elia about 6 years ago

  • Fix Regexp.escape internal regexp
opal -

Published by elia about 6 years ago

  • Added Kernel#rand. (fntzr)

  • Restored the bin/opal executable in gemspec.

  • Now .valueOf() is used in #to_n of Boolean, Numeric, Regexp and String
    to return the naked JavaScript value instead of a wrapping object.

  • Parser now wraps or-ops in paranthesis to stop variable order from
    leaking out when minified by uglify. We now have code in this
    format: (((tmp = lhs) !== false || !==nil) ? tmp : rhs).

opal -

Published by elia about 6 years ago

  • Move sprockets logic out to external opal-sprockets gem. That now
    handles the compiling and loading of opal files in sprockets.
opal -

Published by elia about 6 years ago

  • Added fragments to parser. All parser methods now generate one or
    more Fragments which store the original sexp. This allows us to
    enumerate over them after parsing to map generated lines back to
    original line numbers.

  • Reverted null for nil. Too buggy at this time.

  • Add Opal::SprocketsParser as Parser subclass for handling parsing
    for sprockets environment. This subclass handles require statements
    and stores them for sprockets to use.

  • Add :irb option to parser to keep top level lvars stored inside
    opal runtime so that an irb session can be persisted and maintain
    access to local variables.

  • Add Opal::Environment#use_gem() helper to add a gem to opals load
    path.

  • Stop pre-setting ivars to nil. This is no longer needed as nil
    is now null or undefined.

  • Use null as nil in opal. This allows us to send methods to
    null and undefined, and both act as nil. This makes opal a
    much better javascript citizen. REVERTED

  • Add Enumerable#none? with specs.

  • Add Opal.block_send() runtime helper for sending methods to an
    object which uses a block.

  • Remove _klass variable for denoting ruby classes, and use
    constructor instead. constructor is a javascript property used for
    the same purpose, and this makes opal fit in as a better js citizen.

  • Add Class.bridge_class method to bridge a native constructor into an
    opal class which will set it up with all methods from Object, as
    well as giving it a scope and name.

  • Added native #[]= and #to_h methods, for setting properties and
    converting to a hash respectivaly.

  • Fix bug where '::' was parsed as :colon2 instead of :colon3 when in
    an args scope. Fixes #213

  • Remove lots of properties added to opal classes. This makes normal
    js constructors a lot closer to opal classes, making is easier to
    treat js classes as opal classes.

  • Merge Hash.from_native into Hash.new

opal -

Published by elia about 6 years ago

  • Cleanup runtime, and remove various flags and functions from opal
    objects and classes (moving them to runtime methods).

  • Remove some activesupport methods into external lib.

  • Add/fix lots of String methods, with specs.

  • Add more methods to MatchData class.

  • Implement $' and $` variables.

  • Opal can now call methods on all native objects, via method missing
    dispatcher.

  • Add Opal::Environment as custom sprockets subclass which adds all
    opal load paths automatically.

opal -

Published by elia about 6 years ago

  • Stop inlining respond_to? inside the parser. This now fully respects
    an object overriding respond_to?.

  • Expose Opal.eval() function when parser is loaded for parsing
    and running strings of ruby code.

  • Add erb to corelib (as well as compiler to gem lib). ERB files with
    .opalerb extension will automatically be compiled into Template
    constant.

  • Added some examples into examples/ dir.

  • Add Opal.send() javascript function for sending methods to ruby
    objects.

  • Native class for wrapping and interacting with native objects and
    function calls.

  • Add local_storage to stdlib as a basic wrapper around localStorage.

  • Make method_missing more performant by reusing same dispatch function
    instead of reallocating one for each run.

  • Fix Kernel#format to work in firefox. String.prototype.replace() had
    different semantics for empty matching groups which was breaking
    Kernel#format.

opal -

Published by elia about 6 years ago

  • Fix/add lots of language specs.

  • Seperate sprockets support out to opal-sprockets gem.

  • Support %r[foo] style regexps.

  • Use mspec to run specs on corelib and runtime. Rubyspecs are now
    used, where possible to be as compliant as possible.

opal -

Published by elia about 6 years ago

  • Remove bin/opal - no longer required for building sources.

  • Depreceate Opal::Environment. The Opal::Server class provides a better
    method of using the opal load paths. Opal.paths still stores a list of
    load paths for generic sprockets based apps to use.

opal -

Published by elia about 6 years ago

  • Add Opal::Server as an easy to configure rack server for testing and
    running Opal based apps.

  • Added optional arity check mode for parser. When turned on, every method
    will have code which checks the argument arity. Off by default.

  • Exception subclasses now relfect their name in webkit/firefox debuggers
    to show both their class name and message.

  • Add Class#const_set. Trying to access undefined constants by a literal
    constant will now also raise a NameError.

opal -

Published by elia about 6 years ago

  • Fix bug where methods defined on a parent class after subclass was defined
    would not given subclass access to method. Subclasses are now also tracked
    by superclass, by a private '_inherited' property.

  • Fix bug where classes defined by Class.new did not have a constant scope.

  • Move Date out of opal.rb loading, as it is part of stdlib not corelib.

  • Fix for defining methods inside metaclass, or singleton_class scopes.

opal -

Published by elia about 6 years ago

  • Add Native module used for wrapping objects to forward calls as native calls.

  • Support method_missing for all objects. Feature can be enabled/disabled on Opal::Processor.

  • Hash can now use any ruby object as a key.

  • Move to Sprockets based building via Opal::Processor.

opal -

Published by elia about 6 years ago

Added

  • A console wrapper has been added to the stdlib, requiring it will make available the $console global variable.

  • method_added, method_removed and method_undefined reflection now works.

  • singleton_method_added, singleton_method_removed and singleton_method_undefined reflection now works.

  • Now you can bridge a native class to a Ruby class that inherits from another Ruby class

  • Numeric semantics are now compliant with Ruby.

  • Complex has been fully implemented.

  • Rational has been fully implemented.

  • Kernel#raise now properly re-raises exceptions (regardless of how many levels deep you are) and works properly if supplied a class that has an exception method.

  • Exception#exception, Exception::exception, Exception#message, and Exception#to_s are fully implemented

  • You can make direct JavaScript method calls on using the recv.JS.methodsyntax. Has support for method calls, final callback (as a block), property getter and setter (via #[] and #[]=), splats, JavaScript keywords (via the ::JS module) and global functions (after require "js").

  • Set#superset?, Set#subset?, and the respective proper_ variant of each are now implemented

  • NameError and NoMethodError - add #name and #args attributes

  • RegExp#match now works correctly in multiline mode with white space

  • BasicObject#instance_eval now can accept a string argument (after require "opal-parser")

  • Adds Nashorn (Java 8+ Javascript engine) runner bundle exec bin/opal -R nashorn -r nashorn hello.rb

  • Newly compliant with the Ruby Spec Suite:

    • Enumerable#chunk
    • Enumerable#each_cons
    • Enumerable#minmax
    • Range#to_a (#1246)
    • Module comparison methods: #< #<= #<=> #> #>=
    • OpenStruct#method_missing
    • OpenStruct#inspect
    • OpenStruct#to_s
    • OpenStruct#delete_field

Changed

  • Renamed:
    • Hash.keys => Hash.$$keys
    • Hash.map => Hash.$$map
    • Hash.smap => Hash.$$smap
  • Kernel#pp no longer forwards arguments directly to console.log, this behavior has been replaced by stdlib's own console.rb (see above).
  • Opal::Sprockets.javascript_include_tag has been added to allow easy debug mode (i.e. with source maps) when including a sprockets asset into an HTML page.

Deprecated

  • Opal::Processor.load_asset_code(sprockets, name) has been deprecated in favor of Opal::Sprockets.load_asset(name, sprockets).

Fixed

  • Fixed usage of JavaScript keywords as instance variable names for:
    • Kernel#instance_variable_set
    • Kernel#instance_variable_get
    • Kernel#instance_variables
  • Struct#hash now works properly based on struct contents
  • No longer crashes when calling a method with an opt arg followed by an optional kwarg when called without the kwarg
  • Operator methods (e.g. +, <, etc.) can be handled by method_missing
  • Fix issue where passing a block after a parameter and a hash was causing block to not be passed (e.g. method1 some_param, 'a' => 1, &block)
  • Method defs issued inside Module#instance_eval and Class#instance_eval, and the respective exec now create class methods
  • Now with enabled arity checks calling a method with more arguments than those supported by its signature raises an ArgumentError as well.
  • Previously arity checks would raise an error without clearing the block for a method, that could lead to strange bugs in case the error was rescued.
  • Regexp#=== returns false when the right hand side of the expression cannot be coereced to a string (instead of throwing a TypeError)
  • Regexp#options has been optimized and correctly returns 0 when called on a Regexp literal without any options (e.g. //)
  • Fix Kernel#exit to allow exit inside #at_exit
  • Fixed a number of syntax errors (e.g. #1224 #1225 #1227 #1231 #1233 #1226)
  • Fixed Native() when used with Array instances containing native objects (which weren't wrapped properly) – #1212
  • Fix Array#to_n, Hash#to_n, Struct#to_n when the object contains native objects (#1249)
  • Internal cleanup and lots of bugs!
opal -

Published by elia about 6 years ago

Fixed

  • Backport rack2 compatibility (#1260)
  • Fixed issue with JS nil return paths being treated as true (#1274)
  • Fix using more than two rescue in sequence (#1269)
opal -

Published by elia about 6 years ago

Fixed

  • Rebuilt the gem with Ruby 2.2 as building with 2.3 would make the gem un-installable
opal -

Published by elia about 6 years ago

Fixed

  • Hash#initialize now accepts JS null as well as undefined, restoring its 0.8 behavior
opal -

Published by elia about 6 years ago

Fixed

  • Rebuilt the gem with Rubygems 2.4.8 as building with 2.5.1+ would make the gem un-installable

  • Removed all symlinks from node_module directories to avoid further issues building the gem