Releases: opal/opal
Releases · opal/opal
v1.3.2
Fixed
- Update documentation (#2350)
- Fix
IO#gets
getting an extra char under some circumstances (#2349) - Raise a
TypeError
instead ofUndefinedMethod
if not a string is passed to__send__
(#2346) - Do not modify
$~
when callingString#scan
from internal methods (#2353) - Stop interpreting falsey values as a missing constant in
Module#const_get
(#2354)
v1.3.1
Fixed
- Fix REPL if bundler environment isn't set (#2338)
- Fix Chrome runner if bundler environment isn't set and make it work on other Unixes (#2339)
Proc#binding
to return a binding ifBinding
is defined (#2341, #2340)Array#zip
to correctlyyield
(#2342, #1611)String#scan
to correctlyyield
(#2342, #1660)
v1.3.0
Added
- Add support for
retry
(#2264) - Modernize Exceptions (#2264)
- Add
#cause
,#backtrace_locations
,#full_message
toException
- Normalize backtraces across platforms
- Add
Thread::Backtrace::Location
- Output Exception#full_message on uncaught exceptions (#2269)
- Add
- TracePoint
:class
support (#2049) - Implement the Flip-Flop operators (#2261)
- Add
JS[]
to access properties on the global object (#2259) - Add
ENV.fetch
to the Nodejs implementation ofENV
(#2259) - Opal::Cache, an optional compiler cache (enabled by default) (#2242, #2278, #2329)
- Alias for gvars, alias on main (#2270)
- Support for GJS (GNOME's JavaScript runtime) runner (#2280)
- Scope variables support for
eval()
(#2256) - Add support for
Kernel#binding
(#2256) - A (mostly) correct support for refinements (#2256)
- Add support for ECMAScript modules with an
--esm
CLI option (#2286) - Implement
Regexp#names
and add named captures support (#2272) - REPL improvements: (#2285)
- Colored output & history support
ls
to show available constants and variable
- Add
Method#===
as an alias toMethod#call
, works the same asProc#===
(#2305) - Add
IO#gets
andIO#read_proc
along with other supporting methods (#2309)- Support
#gets
on most platforms, including browsers (viaprompt
) - Move the REPL to a
--repl
CLI option of the main executable - Completely refactor IO, now supporting methods like
#each_line
throughout the entire IO chain - Add a runner for MiniRacer (as
miniracer
) - Support Windows on the Chrome runner
- Support Windows on the REPL
- Platforms an IO implementations should either set
IO#read_proc
or overwriteIO#sysread
- Support
- [experimental] Add support for JavaScript async/await (#2221)
- Enable the feature by adding a magic comment:
# await: true
- The magic comment can be also used to mark specific method patterns to be awaited
(e.g.# await: *_await, sleep
will make any method ending in_await
or namedsleep
to be awaited) - Add
Kernel#__await__
as a bridge to theawait
keyword (inspired by CoffeeScript await support) - Require
opal/await
to get additional support - Read more on the newly added documentation page
- Enable the feature by adding a magic comment:
- Better interoperability between legacy Promise (v1) and native Promise (v2) (#2221)
- Add
PromiseV1
as an alias to the original (legacy) Promise class - Add
#to_v1
and#to_v2
to both classes Promise#to_n
will convert it to a native Promise (v2)
- Add
- Add
Opal::Config.esm
to enable/disable ES modules (#2316)- If Config.esm is enabled, SimpleServer does type="module"
- Add new rack-esm example
- Add a QuickJS (https://bellard.org/quickjs/) runner (#2331)
- Add
IO#fileno
,Method#curry
,Buffer#to_s
,Pathname.pwd
(#2332) - Add NodeJS support for
ARGF
,ENV.{inspect,to_h,to_hash,merge}
,File.{delete,unlink}
,Kernel#system
,Kernel#`
,Process::Status
(#2332) - Introduce
__dir__
support (#2323) - Full autoload support (#2323)
- Now compatible with
opal-zeitwerk
andisomorfeus
- Allow toplevel autoloads
- Allow dynamic autoloads (e.g. can be hooked to fetch a URL upon autoload with a custom loader)
- Allow overwriting
require
(e.g. like rubygems does) - Allow autoloading trees with
require_tree "./foo", autoload: true
- Add Module#autoload?
- Now compatible with
- Autoload parts of the corelib (#2323)
Fixed
- Fixed multiple line
Regexp
literal to not generate invalid syntax as JavaScript (#1616) - Fix
Kernel#{throw,catch}
along withUncaughtThrowError
(#2264) - Update source-map-support to fix an off-by-one error (#2264)
- Source map: lines should start from 1, not 0 (#2273)
- Allow for multiple underscored args with the same name in strict mode (#2292)
- Show instance variables in
Kernel#inspect
(#2285) 0.digits
was returning an empty array in strict mode (#2301)- Non Integer numbers were responding to
#digits
(#2301) - Correctly delete hash members when dealing with boxed strings (#2306)
- Escape string components in interpolated strings (
dstrs
) correctly (#2308) - Don't try to return the JS
debugger
statement, just returnnil
(#2307) - Retain the
-
while stringifying-0.0
(#2304) - Fix super support for rest args and re-assignments with implicit arguments (#2315)
- Fix calling
Regexp#last_match
when$~
is nil (#2328) - Windows support for chrome runner (#2324)
- Use correct node separator for NODE_PATH on Windows
- Pass dir and emulate exec a bit on Windows
- Use Gem.win_platform?, match supported platform to ruby, simplify run
- NodeJS: Drop the first
--
argument inARGV
(#2332) - Fix
Object#require
not pointing toKernel#require
(#2323)
Changed
- Fast-track bad constant names passed to
Struct.new
(#2259) - Renamed internal
super
related helpers,
find_super_dispatcher
is nowfind_super
,find_iter_super_dispatcher
is nowfind_block_super
(#2090) - The
opal-repl
CLI now requires files to be passed with--require
(or-r
) instead of the bare filename (#2309) Process
is now a Module, not a Class - just like in MRI (#2332)s = StringIO.new("a"); s << "b"; s.string
now returns "b", like MRI, but Opal used to return "ab" (#2309)
Internal
v1.3.0.rc1
Please refer to UNRELEASED.md
v1.3.0.alpha1
Please refer to UNRELEASED.md
v1.2.0
Added
- Support for multiple arguments in Hash#{merge, merge!, update} (#2187)
- Support for Ruby 3.0 forward arguments:
def a(...) puts(...) end
(#2153) - Support for beginless and endless ranges:
(1..)
,(..1)
(#2150) - Preliminary support for
**nil
argument - see #2240 to note limitations (#2152) - Support for
Random::Formatters
which add methods#{hex,base64,urlsafe_base64,uuid,random_float,random_number,alphanumeric}
toRandom
andSecureRandom
(#2218) - Basic support for ObjectSpace finalizers and ObjectSpace::WeakMap (#2247)
- A more robust support for encodings (especially binary strings) (#2235)
- Support for
"\x80"
syntax in String literals (#2235) - Added
String#+@
,String#-@
(#2235) - Support for
begin <CODE> end while <CONDITION>
(#2255) - Added Hash#except and
Hash#except!
(#2243) - Parser 3.0: Implement pattern matching (as part of this
{Array,Hash,Struct}#{deconstruct,deconstruct_keys} methods were added)
(#2243) - [experimental] Reimplement Promise to make it bridged with JS native Promise, this new implementation can be used by requiring
promise/v2
(#2220)
Fixed
- Encoding lookup was working only with uppercase names, not giving any errors for wrong ones (#2181, #2183, #2190)
- Fix
Number#to_i
with huge number (#2191) - Add regexp support to
String#start_with
(#2198) String#bytes
now works in strict mode (#2194)- Fix nested module inclusion (#2053)
- SecureRandom is now cryptographically secure on most platforms (#2218, #2170)
- Fix performance regression for
Array#unshift
on v8 > 7.1 (#2116) - String subclasses now call
#initialize
with multiple arguments correctly (with a limitation caused by the String immutability issue, that a source string must be the first argument and#initialize
can't change its value) (#2238, #2185) - Number#step is moved to Numeric (#2100)
- Fix class Class < superclass for invalid superclasses (#2123)
- Fix
String#unpack("U*")
on binary strings with latin1 high characters, fix performance regression on that call (#2235, #2189, #2129, #2099, #2094, #2000, #2128) - Fix
String#to_json
output on some edge cases (#2235) - Rework class variables to support inheritance correctly (#2251)
- ISO-8859-1 and US-ASCII encodings are now separated as in MRI (#2235)
String#b
no longer modifies object strings in-place (#2235)- Parser::Builder::Default.check_lvar_name patch (#2195)
Changed
String#unpack
,Array#pack
,String#chars
,String#length
,Number#chr
, and (only partially)String#+
are now encoding aware (#2235)String#inspect
now uses\x
for binary stirngs (#2235)if RUBY_ENGINE == "opal"
and friends are now outputing less JS code (#2159, #1965)Array
:to_a
,slice
/[]
,uniq
,*
,difference
/-
,intersection
/&
,union
/|
, flatten now return Array, not a subclass, as Ruby 3.0 does (#2237)Array
:difference
,intersection
,union
now accept multiple arguments (#2237)
Deprecated
- Stopped testing Opal on Ruby 2.5 since it reached EOL.
Removed
- Removed support for the outdated
c_lexer
, it was optional and didn't work for the last few releases of parser (#2235)
v1.2.0.beta1
Added
- Support for multiple arguments in Hash#{merge, merge!, update} (#2187)
- Support for Ruby 3.0 forward arguments:
def a(...) puts(...) end
(#2153) - Support for beginless and endless ranges:
(1..)
,(..1)
(#2150) - Preliminary support for
**nil
argument - see #2240 to note limitations (#2152) - Support for
Random::Formatters
which add methods#{hex,base64,urlsafe_base64,uuid,random_float,random_number,alphanumeric}
toRandom
andSecureRandom
(#2218) - Basic support for ObjectSpace finalizers and ObjectSpace::WeakMap (#2247)
- A more robust support for encodings (especially binary strings) (#2235)
- Support for
"\x80"
syntax in String literals (#2235) - Added
String#+@
,String#-@
(#2235) - Support for
begin <CODE> end while <CONDITION>
(#2255)
Fixed
- Encoding lookup was working only with uppercase names, not giving any errors for wrong ones (#2181, #2183, #2190)
- Fix
Number#to_i
with huge number (#2191) - Add regexp support to
String#start_with
(#2198) String#bytes
now works in strict mode (#2194)- Fix nested module inclusion (#2053)
- SecureRandom is now cryptographically secure on most platforms (#2218, #2170)
- Fix performance regression for
Array#unshift
on v8 > 7.1 (#2116) - String subclasses now call
#initialize
with multiple arguments correctly (with a limitation caused by the String immutability issue, that a source string must be the first argument and#initialize
can't change its value) (#2238, #2185) - Number#step is moved to Numeric (#2100)
- Fix class Class < superclass for invalid superclasses (#2123)
- Fix
String#unpack("U*")
on binary strings with latin1 high characters, fix performance regression on that call (#2235, #2189, #2129, #2099, #2094, #2000, #2128) - Fix
String#to_json
output on some edge cases (#2235) - Rework class variables to support inheritance correctly (#2251)
- ISO-8859-1 and US-ASCII encodings are now separated as in MRI (#2235)
String#b
no longer modifies object strings in-place (#2235)
Changed
String#unpack
,Array#pack
,String#chars
,String#length
,Number#chr
, and (only partially)String#+
are now encoding aware (#2235)String#inspect
now uses\x
for binary stirngs (#2235)if RUBY_ENGINE == "opal"
and friends are now outputing less JS code (#2159, #1965)Array
:to_a
,slice
/[]
,uniq
,*
,difference
/-
,intersection
/&
,union
/|
, flatten now return Array, not a subclass, as Ruby 3.0 does (#2237)Array
:difference
,intersection
,union
now accept multiple arguments (#2237)
Deprecated
- Stopped testing Opal on Ruby 2.5 since it reached EOL.
Removed
- Removed support for the outdated
c_lexer
, it was optional and didn't work for the last few releases of parser (#2235)
v1.1.1
v1.1.1.rc1
Version 1.1.1.rc1
v1.1.0
Added
- Basic support for
uplevel:
keyword argument inKernel#warn
(#2006) - Added a
#respond_to_missing?
implementation forBasicObject
,Delegator
,OpenStruct
, that's meant for future support in the Opal runtime, which currently ignores it (#2007) Opal::Compiler#magic_comments
that allows to access magic-comments format and converts it to a hash (#2038)- Use magic-comments to declare helpers required by the file (#2038)
Opal.$$
is now a shortcut forOpal.const_get_relative
(#2038)Opal.$$$
is now a shortcut forOpal.const_get_qualified
(#2038)- Added support for
globalThis
as the generic global object accessor (#2047) Opal::Compiler#magic_comments
that allows to access magic-comments format and converts it to a hash- Use magic-comments to declare helpers required by the file
Opal.$$
is now a shortcut forOpal.const_get_relative
Opal.$$$
is now a shortcut forOpal.const_get_qualified
- Source-map support for Node.js in the default runner (#2045)
- SecureRandom#hex(n) (#2050)
- Added a generic implementation of Kernel#caller and #warn(uplevel:) that works with sourcemaps in Node.js and Chrome (#2065)
- Added support for numblocks
-> { _1 + _2 }.call(3, 4) # => 7
(#2149) - Support
<internal:…>
and<js:…>
in stacktraces, like MRI we now distinguish internal lines from lib/app lines (#2154) Array#difference
,Array#intersection
,Array#union
as aliases respectively toArray#{-,&,|}
(#2151)- Aliases
filter{,!}
toselect{,!}
throughout the corelib classes (#2151) Enumerable#filter_map
,Enumerable#tally
(#2151)- Alias
Kernel#then
forKernel#yield_self
(#2151) - Method chaining:
{Proc,Method}#{<<,>>}
(#2151) - Added Integer#to_d (#2006)
- Added a compiler option
use_strict
which can also be set by theuse_strict
magic comment (#1959) - Add
--rbrequire (-q)
option toopal
command line executable (#2120)
Fixed
- Array#delete_if (#2069)
- Array#keep_if (#2069)
- Array#reject! (#2069)
- Array#select! (#2069)
- Struct#dup (#1995)
- Integer#gcdlcm (#1972)
- Enumerable#to_h (#1979)
- Enumerator#size (#1980)
- Enumerable#min (#1982)
- Enumerable#min_by (#1985)
- Enumerable#max_by (#1985)
- Set#intersect? (#1988)
- Set#disjoint? (#1988)
- Set#keep_if (#1987)
- Set#select! (#1987)
- Set#reject! (#1987)
- String#unicode_normalize (#2175)
- Module#alias_method (#1983)
- Enumerable#minmax_by (#1981)
- Enumerator#each_with_index (#1990)
- Range#== (#1992)
- Range#each (#1991)
- Enumerable#zip (#1986)
- String#getbyte (#2141)
- Struct#dup not copying
$$data
(#1995) - Fixed usage of semicolon in single-line backticks (#2004)
- Module#attr with multiple arguments (#2003)
PathReader
used to try to read missing files instead of respecting themissing_require_severity
configuration value (#2044)- Removed some unused variables from the runtime (#2052)
- Fixed a typo in the runtime (#2054)
- Fix Regexp interpolation, previously interpolating with other regexps was broken (#2062)
- Set match on StringScanner#skip and StringScanner#scan_until (#2061)
- Fix ruby 2.7 warnings (#2071)
- Improve the --help descriptions (#2146)
- Remove BasicObject#class (#2166)
- Time#strftime %j leading zeros (#2161)
- Fix
call { true or next }
producing invalid code (#2160) define_method
can now be called on the main object (#2029)- Fix nested for-loops (#2033)
- Fix Number#round for Integers (#2030)
- Fix parsing Unicode characters from Opal (#2073)
- Integer#===: improve Integer recognition (#2089)
- Regexp: ensure ignoreCase is never undefined (#2098)
- Hash#delete: ensure String keys are converted to values (#2106)
- Array#shift: improve performance on v8 >7.1 (#2115)
- Array#pop(1): improve performance (#2130)
- Object#pretty_inspect (#2139)
- Fix conversion from UTF-8 to bytes (#2138)
- Restore compatibility with Chrome 38, used by Cordova and many mobile browsers (#2109)
Changed
- Updated outdated parser version (#2013)
- Nashorn has been deprecated but GraalVM still supports it (#1997)
- "opal/mini" now includes "opal/io" (#2002)
- Regexps assigned to constants are now frozen (#2007)
Opal.$$
changed from being the constant cache of Object to being a shortcut forOpal.const_get_relative
(#2038)- Moved REPL implementation from bin/ to its own lib/ file as
opal/repl.rb
(#2048) Encoding.default_external
is now initialized with__ENCODING__
(#2072)- Keep the MersenneTwister implementation private (#2108)
- Change parser to 3.0 (#2148)
- Fix forwarding a rescued error to a global var:
rescue => $gvar
(#2154) - Now using Parser v3.0 and targeting Ruby 3.0 (#2156)
Comparable#clamp
to support a Range argument (#2151)#to_h
method to support a block (shortform for.map(&block).to_h
) (#2151)- BigDecimal is now a subclass of Numeric (#2006)
- PP to be rebased on upstream Ruby version (#2083)
- String to report UTF-8 encoding by default, as MRI does (#2117)
- Don't output "Failed to load WithCLexer, using pure Ruby lexer" warning unless in $DEBUG mode (#2174)
Deprecated
- Requiring nodejs/stacktrace has been deprecated, source-maps are already
supported by the default Node.js runner or by requiring https://github.com/evanw/node-source-map-support
before loading code compiled by Opal (#2045)