Skip to content

Releases: opal/opal

v0.11.2

01 Sep 10:57
Compare
Choose a tag to compare

Fixed

  • Remove symlink that caused problems on Windows

v0.11.1

01 Sep 10:57
Compare
Choose a tag to compare

Added

  • Added support for a static folder in the "server" CLI runner via the OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER env var
  • Added ability to pass the port to the "server" CLI runner using the OPAL_CLI_RUNNERS_SERVER_PORT (explicit option passed via CLI is still working but deprecated)
  • 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 by dynamic_require_severity. Not to be confused with the runtime config option Opal.config.missing_require_severity; which controls the runtime behavior.
  • At run-time LoadError wasn't being raised even with Opal.config.missing_require_severity; set to 'error'.

v0.10.6

01 Sep 11:01
Compare
Choose a tag to compare

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

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

v0.11.0

05 Feb 18:39
8a4f5a4
Compare
Choose a tag to compare

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)
  • 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.

v0.10.5

21 Jun 21:22
Compare
Choose a tag to compare

Fixed

  • Fix Time#zone for zones expressed numerically

v0.10.4

21 Jun 21:23
96a2188
Compare
Choose a tag to compare

Changed

  • Better Opal::Config options documentation and organization
  • Always cache source-maps at build-time so they're available once enabled

v0.10.3

21 Jun 21:23
Compare
Choose a tag to compare

Fixed

  • Fixed inheritance from the Module class (#1476)
  • Fixed source map server with url-encoded paths
  • Silence Sprockets 3.7 deprecations, full support for Sprockets 4 will be available in Opal 0.11
  • Don't print the full stack trace with deprecation messages

v0.10.2

21 Jun 21:23
Compare
Choose a tag to compare

Changed

  • Avoid special utf-8 chars in method names, now they start with $$

v0.10.1

21 Jun 21:23
Compare
Choose a tag to compare

Fixed

  • Fixed -L option for compiling requires as modules (#1510)

v0.10.0

21 Jun 21:24
Compare
Choose a tag to compare

Added

  • Pathname#relative_path_from
  • Source maps now include method names
  • Module#included_modules works
  • Internal runtime cleanup (#1241)
  • Make it easier to add custom runners for the CLI (#1261)
  • Add Rack v2 compatibility (#1260)
  • Newly compliant with the Ruby Spec Suite:
    • Array#slice!
    • Array#repeated_combination
    • Array#repeated_permutation
    • Array#sort_by!
    • Enumerable#sort
    • Enumerable#max
    • Enumerable#each_entry (#1303)
    • Module#const_set
    • Module#module_eval with a string
  • Add -L / --library option to compile only the code of the library (#1281)
  • Implement Kernel.open method (#1218)
  • Generate meaningful names for functions representing Ruby methods
  • Implement Pathname#join and Pathname#+ methods (#1301)
  • Added support for begin;rescue;else;end.
  • Implement File.extname method (#1219)
  • Added support for keyword arguments as lambda parameters.
  • Super works with define_method blocks
  • Added support for kwsplats.
  • Added support for squiggly heredoc.
  • Implement Method#parameters and Proc#parameters.
  • Implement File.new("path").mtime, File.mtime("path"), File.stat("path").mtime.
  • if-conditions now support null and undefined as falsy values (#867)
  • Implement IO.read method for Node.js (#1332)
  • Implement IO.each_line method for Node.js (#1221)
  • Generate opal-builder.js to ease the compilation of Ruby library from JavaScript (#1290)

Changed

  • Remove deprecation of Opal::Environment after popular request
  • Setting Opal::Config.dynamic_require_severity will no longer affect Opal.dynamic_require_severity which now needs to be explicitly set if it differs from the default value of "warning" (See also the Opal.dynamic_require_severity rename below).
  • The new default for Opal::Config.dynamic_require_severity is now :warning
  • Opal.dynamic_require_severity and OPAL_CONFIG are now merged into Opal.config.missing_require_severity (defaults to error, the expected ruby behavior) and Opal.config.unsupported_features_severity (defaults to warning, e.g. a one-time heads up that freezing isn't supported). Added variable __OPAL_COMPILER_CONFIG__ that contains compiler options that may be used in runtime.
  • Hash instances should now list the string map ($$smap) as the first key, making debugging easier (most hashes will just have keys there).
  • Handle Pathname object in Pathname constructor

Deprecated

  • Opal::Processor.stubbed_files and Opal::Processor.stub_file in favor of Opal::Config.stubbed_files

Removed

  • Removed the previously deprecated Opal::Fragment#to_code
  • Removed the previously deprecated Opal::Processor.load_asset_code
  • Removed the previously deprecated acceptance of a boolean as single argument to Opal::Server.new

Fixed

  • Module#ancestors and shared code like ==== and is_a? deal with singleton class modules better (#1449)
  • Class#to_s now shows correct names for singleton classes
  • Pathname#absolute? and Pathname#relative? now work properly
  • File::dirname and File::basename are now Rubyspec compliant
  • SourceMap::VLQ patch (#1075)
  • Regexp::new no longer throws error when the expression ends in \\
  • super works properly with overwritten alias methods (#1384)
  • NoMethodError does not need a name to be instantiated
  • method_added fix for singleton class cases
  • Super now works properly with blocks (#1237)
  • Fix using more than two rescue in sequence (#1269)
  • Fixed inheritance for Array subclasses.
  • Always populate all stub_subscribers with all method stubs, as a side effect of this now method_missing on bridged classes now works reliably (#1273)
  • Fix Hash#instance_variables to not return #default and #default_proc (#1258)
  • Fix Module#name when constant was created using Opal.cdecl (constant declare) like ChildClass = Class.new(BaseClass) (#1259)
  • Fix issue with JavaScript nil return paths being treated as true (#1274)
  • Fix Array#to_n, Hash#to_n, Struct#to_n when the object contains native objects (#1249, #1256)
  • break semantics are now correct, except for the case in which a lambda containing a break is passed to a yield (#1250)
  • Avoid double "/" when Opal::Sprockets.javascript_include_tag receives a prefix with a trailing slash.
  • Fixed context of evaluation for Kernel#eval and BasicObject#instance_eval
  • Fix Module#=== to use all ancestors of the passed object (#1284)
  • Fix Struct.new to be almost compatible with Rubyspec (#1251)
  • Fix Enumerator#with_index to return the result of the previously called method.
  • Improved Date.parse to cover most date formatting cases.
  • Fixed Module#const_get for dynamically created constants.
  • Fixed File.dirname to return joined String instead of Array.
  • Fixed multiple assignment for constants, i.e., allowing A, B = 1, 2.
  • Fixed Number#[] with negative number. Now (-1)[1] returns 1.
  • Fixed parsing of pre-defined $-? global variables.
  • Fixed parsing of unicode constants.
  • Fixed parsing of quoted heredoc identifier.
  • Fixed parsing of mass assignment of method call without parentheses.
  • Fixed parsing of %I{} lists.
  • Fixed parsing of %{} lists when list item contains same brackets.
  • Fixed an issue with "-" inside the second arg of String#tr
  • Fixed Base64 and enabled specs
  • Fixed method definition in method body.
  • Partially implemented Marshal.load/Marshal.dump. In order to use it require opal/full.
  • Fixed docs for Compiled Ruby - Native section. Rename opal variable to win since window was causing error
  • Fixed the --map option, now correclty outputs the sourcemap as json

Removed

  • Remove support for configuring Opal via Opal::Processor, the correct place is Opal::Config
  • Remove Opal.process which used to be an alias to Sprockets::Environment#[]