Opal v0.11.0 Release Notes

Release Date: 2017-12-08 // over 6 years ago
  • ➕ Added

    • ➕ Added support for complex (0b1110i) and rational (0b1111r) number literals. (#1487)
    • ➕ Added 2.3.0 methods:
      • Array#bsearch_index
      • Array#dig
      • Enumerable#chunk_while
      • Enumerable#grep_v
      • Enumerable#slice_after
      • Enumerable#slice_when
      • Hash#>
      • Hash#<
      • Hash#>=
      • Hash#>=
      • Hash#dig
      • Hash#fetch_values
      • Hash#to_proc
      • Struct#dig
      • Kernel#itself
    • ➕ Added safe navigator (&.) support. (#1532)
    • ➕ Added Random class with seed support. The following methods were reworked to use it:
      • Kernel.rand
      • Kernel.srand
      • Array#shuffle
      • Array#shuffle!
      • Array#sample
    • ➕ Added rudimental history support to opal-repl, just create the history file (~/.opal-repl-history) and it record the last 1000 lines
    • ➕ Added JS::Error error class that can be used to catch any JS error.
    • ➕ Added Method#source_location and Method#comments.
    • Added a deprecation API that can be set to raise on deprecation with: Opal.raise_on_deprecation = true
    • Added Opal::SimpleServer as the quickest way to get up and running with Opal: rackup -ropal -ropal/simple_server -b 'Opal.append_path("app"); run Opal::SimpleServer.new'
    • ➕ Added String#ascii_only? (#1592)
    • ➕ Added StringScanner#matched_size (#1595)
    • Added Hash#compare_by_identity (#1657)

    ✂ Removed

    • ⬇️ Dropped support for IE8 and below, and restricted Safari and Opera support to the last two versions
    • ⬇️ Dropped support for PhantomJS as it was abandoned.

    🔄 Changed

    • ✂ Removed self-written lexer/parser. Now uses parser/ast gems to convert source code to AST. (#1465)
    • 📜 Migrated parser to 2.3. Bump RUBY_VERSION to 2.3.0.
    • 🔄 Changed to be 2.3 compliant:
      • Enumerable#chunk (to take only a a block)
      • Enumerable#slice_before (to raise proper argument errors)
      • Number#positive? (to return false for 0)
    • Use meaningful names for temporary variables in compiled JavaScript (e.g. for def foo was TMP_123, now TMP_foo_123)
    • 0️⃣ Dynamic require severity now defaults to :ignore meaning that by default a LoadError will be raised at runtime instead of compile time.

    🗄 Deprecated

    • 🗄 require 'opal/server and Opal::Server are deprecated in favor of require 'opal/sprockets/server' and Opal::Sprockets::Server (now part of the opal-sprockets gem).

    ✂ Removed

    • ✂ Removed yaml from stdlib, the older implementation was only available for NodeJS and not tested. Replace with require 'nodejs/yaml'
    • ⚡️ Extracted sprockets support to opal-sprockets which should allow for wider support and less coupling (e.g. the opal gem will now be able to improve the compiler without worrying about sprockets updates). All the old behavior is preserved except for Opal::Server that has become Opal::Sprockets::Server (see Deprecated section above).

    🔄 Changed

    • 💻 Strip Regexp flags that are unsupported by browsers (backport), previously they were ignored, lately most of them now raise an error for unknown flags.

    🛠 Fixed

    • 🆕 Newly compliant with the Ruby Spec Suite:

      • Module#class_variables
      • Module#class_variable_get
      • Module#class_variable_set
      • Module#remove_class_variable
      • Module#include?
      • Numeric#step (#1512)
    • 👌 Improvements for Range class (#1486)

      • Moved private/tainted/untrusted specs to not supported
      • Conforming Range#to_s and Range#inspect
      • Starting Range#bsearch implementation
      • Simple Range#step implementation
      • Fixing Range#min for empty Ranges
      • Fixing Range#last(n) Range#first(n) and one edge case of Range#each
      • Fixing some Range#step issues on String ranges
      • Simple Range#bsearch implementation, passes about half the specs
      • Minor styling improvements. Fixed size of Range#step.
      • Compile complex ranges to "Range.new" so there will be a check for begin and end to be comparable.
    • 🛠 Fixed defined? for methods raising exceptions

    • 🛠 Fixed Kernel#loop (to catch StopIteration error)

    • 🛠 Fixed inheritance from the Module class.

    • 🛠 Fixed using --preload along with --no-opal for CLI

    • 🛠 Fixed Integer("0") raising ArgumentError instead of parsing as 0

    • 🛠 Fixed JSON#parse to raise JSON::ParserError for invalid input

    • Module#append_features now detects cyclic includes

    • Process.clock_gettime(Process::CLOCK_MONOTONIC) will now return true monotonic values or raise Errno::EINVAL if no monotonic clock is available

    • Opal::Builder no longer always raises an error when a dependency isn't found and instead respects dynamic_require_severity value

    • 🛠 Fixed a constant reference to Sprockets::FileNotFound that previously pointed to Opal::Sprockets instead of ::Sprockets.