Skip to content

Releases: opal/opal

v1.3.2

10 Nov 09:18
v1.3.2
b163671
Compare
Choose a tag to compare

Fixed

  • Update documentation (#2350)
  • Fix IO#gets getting an extra char under some circumstances (#2349)
  • Raise a TypeError instead of UndefinedMethod if not a string is passed to __send__ (#2346)
  • Do not modify $~ when calling String#scan from internal methods (#2353)
  • Stop interpreting falsey values as a missing constant in Module#const_get (#2354)

v1.3.1

03 Nov 08:59
v1.3.1
9c8ea6d
Compare
Choose a tag to compare

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 if Binding is defined (#2341, #2340)
  • Array#zip to correctly yield (#2342, #1611)
  • String#scan to correctly yield (#2342, #1660)

v1.3.0

27 Oct 08:53
v1.3.0
7a2b1ee
Compare
Choose a tag to compare

Added

  • Add support for retry (#2264)
  • Modernize Exceptions (#2264)
    • Add #cause, #backtrace_locations, #full_message to Exception
    • Normalize backtraces across platforms
    • Add Thread::Backtrace::Location
    • Output Exception#full_message on uncaught exceptions (#2269)
  • 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 of ENV (#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 to Method#call, works the same as Proc#=== (#2305)
  • Add IO#gets and IO#read_proc along with other supporting methods (#2309)
    • Support #gets on most platforms, including browsers (via prompt)
    • 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 overwrite IO#sysread
  • [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 named sleep to be awaited)
    • Add Kernel#__await__ as a bridge to the await keyword (inspired by CoffeeScript await support)
    • Require opal/await to get additional support
    • Read more on the newly added documentation page
  • 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 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 and isomorfeus
    • 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?
  • 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 with UncaughtThrowError (#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 return nil (#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 in ARGV (#2332)
  • Fix Object#require not pointing to Kernel#require (#2323)

Changed

  • Fast-track bad constant names passed to Struct.new (#2259)
  • Renamed internal super related helpers,
    find_super_dispatcher is now find_super, find_iter_super_dispatcher is now find_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

  • Switch from jshint to ESLint (#2289)
  • Switch from UglifyJS to Terser (#2318)
  • [CI] Performance regression check (#2276, #2282)

v1.3.0.rc1

20 Oct 09:17
v1.3.0.rc1
f7db8c2
Compare
Choose a tag to compare
v1.3.0.rc1 Pre-release
Pre-release

Please refer to UNRELEASED.md

v1.3.0.alpha1

29 Sep 08:50
v1.3.0.alpha1
d628936
Compare
Choose a tag to compare
v1.3.0.alpha1 Pre-release
Pre-release

Please refer to UNRELEASED.md

v1.2.0

11 Aug 07:31
v1.2.0
82e1a12
Compare
Choose a tag to compare

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} to Random and SecureRandom (#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

23 Jul 09:45
v1.2.0.beta1
584d8e7
Compare
Choose a tag to compare
v1.2.0.beta1 Pre-release
Pre-release

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} to Random and SecureRandom (#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

23 Feb 11:47
v1.1.1
bdd7ea2
Compare
Choose a tag to compare

Fixed

  • The default runner (nodejs) wasn't starting to a bad require in the improved stack-traces (#2182)

v1.1.1.rc1

23 Feb 11:47
v1.1.1.rc1
782eb13
Compare
Choose a tag to compare
v1.1.1.rc1 Pre-release
Pre-release
Version 1.1.1.rc1

v1.1.0

19 Feb 11:21
v1.1.0
ce270bd
Compare
Choose a tag to compare

Added

  • Basic support for uplevel: keyword argument in Kernel#warn (#2006)
  • Added a #respond_to_missing? implementation for BasicObject, 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 for Opal.const_get_relative (#2038)
  • Opal.$$$ is now a shortcut for Opal.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 for Opal.const_get_relative
  • Opal.$$$ is now a shortcut for Opal.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 to Array#{-,&,|} (#2151)
  • Aliases filter{,!} to select{,!} throughout the corelib classes (#2151)
  • Enumerable#filter_map, Enumerable#tally (#2151)
  • Alias Kernel#then for Kernel#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 the use_strict magic comment (#1959)
  • Add --rbrequire (-q) option to opal 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 the missing_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 for Opal.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

Removed

  • Removed special compilation for the Opal.truthy? and Opal.falsy? helpers (#2076)
  • Removed the deprecated tainting compiler config option (#2072)