-
Added
Module#prepend
and completely overhauled the module and class inheritance system (#1826) -
Methods and properties are now assigned with
Object.defineProperty()
as non-enumerable (#1821) -
Backtrace now includes the location inside the source file for syntax errors (#1814)
-
Added support for a faster C-implemented lexer, it's enough to add
gem 'c_lexer
to theGemfile
(#1806) -
Added
Date#to_n
that returns the JavaScript Date object (in native.rb). (#1779, #1792) -
Added
Array#pack
(supports onlyC, S, L, Q, c, s, l, q, A, a
formats). (#1723) -
Added
String#unpack
(supports onlyC, S, L, Q, S>, L>, Q>, c, s, l, q, n, N, v, V, U, w, A, a, Z, B, b, H, h, u, M, m
formats). (#1723) -
Added
File#symlink?
for Node.js. (#1725) -
Added
Dir#glob
for Node.js (does not support flags). (#1727) -
Added support for a static folder in the "server" CLI runner via the
OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER
env var -
Added the CLI option
--runner-options
that allows passing arbitrary options to the selected runner, currently the only runner making use of them isserver
acceptingport
andstatic_folder
-
Added a short helper to navigate constants manually: E.g.
Opal.$$.Regexp.$$.IGNORECASE
(see docs for "Compiled Ruby") -
Added initial support for OpenURI module (using XMLHttpRequest on browser and xmlhttprequest on Node). (#1735)
-
Added
String#prepend
to the list of unsupported methods (because String are immutable in JavaScript) -
Added methods (most introduced in 2.4/2.5):
Array#prepend
(#1757)Array#append
(#1757)Array#max
(#1757)Array#min
(#1757)Complex#finite?
(#1757)Complex#infinite?
(#1757)Complex#infinite?
(#1757)Date#to_time
(#1757)Date#next_year
(#1885)Date#prev_year
(#1885)Hash#slice
(#1757)Hash#transform_keys
(#1757)Hash#transform_keys!
(#1757)Numeric#finite?
(#1757)Numeric#infinite?
(#1757)Numeric#infinite?
(#1757)Integer#allbits?
(#1757)Integer#anybits?
(#1757)Integer#digits
(#1757)Integer#nobits?
(#1757)Integer#pow
(#1757)Integer#remainder
(#1757)Integer.sqrt
(#1757)Random.urandom
(#1757)String#delete_prefix
(#1757)String#delete_suffix
(#1757)String#casecmp?
(#1757)Kernel#yield_self
(#1757)String#unpack1
(#1757)String#to_r
(#1842)String#to_c
(#1842)String#match?
(#1842)String#unicode_normalize
returns self (#1842)String#unicode_normalized?
returns true (#1842)String#[]=
throwsNotImplementedError
(#1836)
-
Added support of the
pattern
argument forEnumerable#all?
,Enumerable#any?
,Enumerable#none?
. (#1757) -
Added
ndigits
option support toNumber#floor
,Number#ceil
,Number#truncate
. (#1757) -
Added
key
andreceiver
attributes to theKeyError
. (#1757) -
Extended
Struct.new
to supportkeyword_init
option. (#1757) -
Added a new
Opal::Config.missing_require_severity
option and relative--missing-require
CLI flag. This option will command how the builder will behave when a required file is missing. Previously the behavior was undefined and partly controlled bydynamic_require_severity
. Not to be confused with the runtime config optionOpal.config.missing_require_severity;
which controls the runtime behavior. -
Added
Matrix
(along with the internal MRI utilityE2MM
) -
Use shorter helpers for constant lookups,
$$
for relative (nesting) lookups and$$$
for absolute (qualified) lookups -
Add support for the Mersenne Twister random generator, the same used by CRuby/MRI (#657 & #1891)
-
[Nodejs] Added support for binary data in
OpenURI
(#1911, #1920) -
[Nodejs] Added support for binary data in
File#read
(#1919, #1921) -
[Nodejs] Added support for
File#readlines
(#1882) -
[Nodejs] Added support for
ENV#[]
,ENV#[]=
,ENV#key?
,ENV#has_key?
,ENV#include?
,ENV#member?
,ENV#empty?
,ENV#keys
,ENV#delete
andENV#to_s
(#1928)
- BREAKING The dot (
.
) character is no longer replaced with [\s\S] in a multiline regexp passed to Regexp#match and Regexp#match? (#1796, #1795)- You're advised to always use [\s\S] instead of . in a multiline regexp, which is portable between Ruby and JavaScript
- BREAKING
Kernel#format
(andsprintf
alias) are now in a dedicated modulecorelib/kernel/format
and available exclusively inopal
(#1930)- Previously the methods were part of the
corelib/kernel
module and available in bothopal
andopal/mini
- Previously the methods were part of the
- Filename extensions are no longer stripped from filenames internally, resulting in better error reporting (#1804)
- The internal API for CLI runners has changed, now it's just a callable object
- The
--map
CLI option now works only in conjunction with--compile
(or--runner compiler
) - The
node
CLI runner now adds itsNODE_PATH
entry instead of replacing the ENV var altogether - Added
--disable-web-security
option flag to the Chrome headless runner to be able to doXMLHttpRequest
- Migrated parser to 2.5. Bump RUBY_VERSION to 2.5.0.
- Exceptions raised during the compilation now add to the backtrace the current location of the opal file if available (#1814).
- Better use of
displayName
on functions and methods and more readable temp variable names (#1910) - Source-maps are now inlined and already contain sources, incredibly more stable and precise (#1856)
- The CLI
--server-port 1234
option is now deprecated in favor of using--runner-options='{"port": 1234}'
- Including
::Native
is now deprecated because it generates conflicts with core classes in constant lookups (bothNative::Object
andNative::Array
exist). InsteadNative::Werapper
should be used. - Using
node_require 'my_module'
to access the nativerequire()
function in Node.js is deprecated in favor of`require('my_module')`
because static builders need to parse the call in order to function (#1886).
- The
node
CLI runner no longer supports passing extra node options via theNODE_OPT
env var, instead Node.js natively supports theNODE_OPTIONS
env var. - The gem "hike" is no longer an external dependency and is now an internal dependency available as
Opal::Hike
(#1881) - Removed the internal Opal class
Marshal::BinaryString
(#1914) - Removed Racc, as it's now replaced by the parser gem (#1880)
- Fix handling of trailing semicolons and JavaScript returns inside x-strings, the behavior is now well defined and covered by proper specs (#1776)
- Fixed singleton method definition to return method name. (#1757)
- Allow passing number of months to
Date#next_month
andDate#prev_month
. (#1757) - Fixed
pattern
argument handling forEnumerable#grep
andEnumerable#grep_v
. (#1757) - Raise
ArgumentError
instead ofTypeError
fromNumeric#step
when step is not a number. (#1757) - At run-time
LoadError
wasn't being raised even withOpal.config.missing_require_severity;
set to'error'
. - Fixed
Kernel#public_methods
to return instance methods if the argument is set to false. (#1848) - Fixed an issue in
String#gsub
that made it start an infinite loop when used recursively. (#1879) Kernel#exit
was using status 0 when a number or a generic object was provided, now accepts numbers and tries to convert objects with#to_int
(#1898, #1808).- Fixed metaclass inheritance in subclasses of Module (#1901)
Method#to_proc
now correctly sets parameters and arity on the resulting Proc (#1903)- Fixed bridged classes having their prototype removed from the original chain by separating them from the Ruby class (#1909)
- Improve
String#to_proc
performance (#1888) - Fixed/updated the examples (#1887)
Opal.ancestors()
now returns false for when provided with JS-falsy objects (#1839)- When subclassing now the constant is set before calling
::inherited
(#1838) String#to_sym
now returns the string literal (#1835)String#center
now correctly checks length (#1833)redo
insidewhile
now works properly (#1820)- Fixed compilation of empty/whitespace-only x-strings (#1811)
- Fix
||=
assignments on constants when the constant is not yet defined (#1935) - Fix
String#chomp
to return an empty String whenarg == self
(#1936)