Bot releases are hidden (Show)
Sprockets::FileNotFound
that previously pointed to Opal::Sprockets
instead of ::Sprockets
.OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER
env varOPAL_CLI_RUNNERS_SERVER_PORT
(explicit option passed via CLI is still working but deprecated)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.LoadError
wasn't being raised even with Opal.config.missing_require_severity;
set to 'error'
.Published by elia over 6 years ago
0b1110i
) and rational (0b1111r
) number literals. (#1487)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
&.
) support. (#1532)Kernel.rand
Kernel.srand
Array#shuffle
Array#shuffle!
Array#sample
opal-repl
, just create the history file (~/.opal-repl-history
) and it record the last 1000 linesJS::Error
error class that can be used to catch any JS error.Method#source_location
and Method#comments
.Opal.raise_on_deprecation = true
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'
String#ascii_only?
(#1592)StringScanner#matched_size
(#1595)Hash#compare_by_identity
(#1657)Enumerable#chunk
(to take only a a block)Enumerable#slice_before
(to raise proper argument errors)Number#positive?
(to return false for 0)def foo
was TMP_123
, now TMP_foo_123
):ignore
meaning that by default a LoadError
will be raised at runtime instead of compile time.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).yaml
from stdlib, the older implementation was only available for NodeJS and not tested. Replace with require 'nodejs/yaml'
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).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)
Range#to_s
and Range#inspect
Range#bsearch
implementationRange#step
implementationRange#min
for empty RangesRange#last(n)
Range#first(n)
and one edge case of Range#each
Range#step
issues on String rangesRange#bsearch
implementation, passes about half the specsRange#step
.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
.
Module#included_modules
worksArray#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-L
/ --library
option to compile only the code of the library (#1281)Kernel.open
method (#1218)Pathname#join
and Pathname#+
methods (#1301)begin;rescue;else;end
.File.extname
method (#1219)Method#parameters
and Proc#parameters
.File.new("path").mtime
, File.mtime("path")
, File.stat("path").mtime
.null
and undefined
as falsy values (#867)opal-builder.js
to ease the compilation of Ruby library from JavaScript (#1290)Opal::Environment
after popular requestOpal::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).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).Opal::Processor.stubbed_files
and Opal::Processor.stub_file
in favor of Opal::Config.stubbed_files
Opal::Fragment#to_code
Opal::Processor.load_asset_code
Opal::Server.new
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 classesPathname#absolute?
and Pathname#relative?
now work properlyFile::dirname
and File::basename
are now Rubyspec compliantSourceMap::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 instantiatedmethod_added
fix for singleton class casesrescue
in sequence (#1269)Array
subclasses.method_missing
on bridged classes now works reliably (#1273)Hash#instance_variables
to not return #default
and #default_proc
(#1258)Module#name
when constant was created using Opal.cdecl
(constant declare) like ChildClass = Class.new(BaseClass)
(#1259)nil
return paths being treated as true (#1274)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)Opal::Sprockets.javascript_include_tag
receives a prefix with a trailing slash.Kernel#eval
and BasicObject#instance_eval
Module#===
to use all ancestors of the passed object (#1284)Struct.new
to be almost compatible with Rubyspec (#1251)Enumerator#with_index
to return the result of the previously called method.Date.parse
to cover most date formatting cases.Module#const_get
for dynamically created constants.File.dirname
to return joined String instead of Array.A, B = 1, 2
.Number#[]
with negative number. Now (-1)[1]
returns 1.$-?
global variables.%I{}
lists.%{}
lists when list item contains same brackets."-"
inside the second arg of String#tr
Marshal.load
/Marshal.dump
. In order to use it require opal/full
.--map
option, now correclty outputs the sourcemap as jsonOpal::Processor
, the correct place is Opal::Config
Opal.process
which used to be an alias to Sprockets::Environment#[]
Stop keyword-arg variable names leaking to global javascript scope
Class#native_class
now also exposes MyClass.new
(Ruby) as Opal.global.MyClass.new()
(JS)
Add CRuby (MRI) tests harness to start checking Opal against them too.
Add Minitest to the stdlib.
Add Date#<=>
with specs.
Show extended info and context upon parsing, compiling and building errors.
Support keyword arguments in method calls and definitions.
Fix begin
/rescue
blocks to evaluate to last expression.
Add support for RUBY_ENGINE/RUBY_PLATFORM != "opal"
pre-processor directives.
if RUBY_ENGINE != "opal"
# this code never compiles
end
Fix donating methods defined in modules. This ensures that if a class includes more than one module, then the methods defined on the class respect the order in which the modules are included.
Improved support for recursive Hash
for both #inspect
and #hash
.
Optimized Hash
implementation for String
and Symbol
, they have a separate hash-table in which they're used as both keys and hashes.
Added real #hash
/ eql?
support, previously was relying on .toString()
.
String#to_proc
now uses __send__
instead of send
for calling
methods on receivers.
Deprecated Opal::Sprockets::Environment
. It can easily be replaced by Opal::Server
or by appending Opal.paths
to a Sprockets::Environment
:
Sprockets::Environment.new.tap { |e| Opal.paths.each {|p| e.append_path(p)} }
Add Set
methods #classify
, #collect!
, #map!
, #subtract
#replace
,
#difference
and #eql?
Support module_function
without args to toggle module functions.
Fix bug where command calls with no space and sym arg were incorrectly parsed.
Add some StringScanner
methods.
Add Date#<<
and Date#>>
implementations.
Support nested directories using require_tree
directive.
Fix bug where Exception subclasses could not have methods defined on them.
Fix symbols with interpolations :"#{foo}"
Implement $1..N matchers and rewrite support for $~, $', $& and $`.
Implement Regexp.last_match
.
Fixed -@
unary op. precedence with a numeric and followed by a method call (e.g. -1.foo
was parsed as -(1.foo)
)
require_relative
(with strings) is now preprocessed, expanded and added to Compiler#requires
Rewritten the require system to respect requires position (previously all the requires were stacked up at the top of the file)
Implement for-loop syntax
Add Array#|
Fix Range.new to raise ArgumentError
on contructor values that cannot
be compared
Fix compiler bug where Contiguous strings were not getting concatenated.
Cleanup generated code for constant access. All constant lookups now go through $scope.get('CONST_NAME')
to produce cleaner code and a unified place for const missing dispatch.
Remove const_missing
option from compiler. All constant lookups are now strict.
Add initial support for Module#autoload.
Fix Enumerator#with_index
, Numeric#round
.
-d
and -v
now set respectively $DEBUG
and $VERBOSE
-v
CLI option wait for STDIN input-E
/ --no-exit
CLI option to skip implicit Kernel#exit
callKernel#exit
at the end of the script, thus making at_exit
blocks be respected.Hash[]
implementation fully compliant with rubyspec
Newly compliant with the Ruby Spec Suite:
Array#bsearch
Array#combination
Array#permutation
Array#product
Array#rotate!
Array#rotate
Array#sample
Array#to_h
Array#values_at
Array#zip
Enumerator#with_index
Kernel#===
Kernel#Array
Kernel#Float
Kernel#Hash
Kernel#Integer
Kernel#String
Kernel#format
Kernel#sprintf
MatchData#==
MatchData#eql?
MatchData#values_at
Module#instance_methods
Regexp#match
String#%
String#===
String#==
String#[]
String#each_line
String#eql?
String#index
String#inspect
String#lines
String#match
String#next
String#oct
String#scan
String#slice
String#split
String#succ
String#to_i
String#try_convert
minitest
from stdlib. It's not part of MRI and it never belonged there, checkout the opal-minitest
gem instead.Opal.load
or Opal.require
.Opal::Processor.load_asset_code(sprockets, name)
does just that in the right way.Promise#always
.String#split
when no match is found and a limit is providedrequire_tree(".")
when used from file at the root of the assets pathsModule#const_get
now accepts a scoped constant nameRegexp#===
sets global match data varsOpal::Processor.cache_key
and Opal::Processor.reset_cache_key!
toOpal::Config
changes.Published by elia over 10 years ago
Added Range#size
opal
executable now reads STDIN when no file or -e
are passed
opal
executable doesn't exit after showing version on -v
if other options are passed
(Internal) improved the mspec runner
Published by elia over 10 years ago
Fix parsing of escapes in single-strings ('foo\n'). Only ' and
characters now get escaped in single quoted strings. Also, more escape
sequences in double-quoted strings are now supported: \a
, \v
, \f
,
\e
, \s
, octal (\314
), hex (\xff
) and unicode (\u1234
).
Sourcemaps revamp. Lexer now tracks column and line info for every token to
produce much more accurate sourcemaps. All method calls are now located on
the correct source line, and multi-line xstrings are now split to generate
a map line-to-line for long inline javascript parts.
Merged sprockets support from opal-sprockets
directly into Opal. For the
next release, the exernal opal-sprockets
gem is no longer needed. This
commit adds Opal::Processor
, Opal::Server
and Opal::Environment
.
Introduce pre-processed if directives to hide code from Opal. Two special
constant checks now take place in the compiler. Either RUBY_ENGINE
or
RUBY_PLATFORM
when == "opal"
. Both if and unless statements can pick
up these logic checks:
if RUBY_ENGINE == "opal"
# this code compiles
else
# this code never compiles
end
Unless:
unless RUBY_ENGINE == "opal"
# this code never compiles
end
This is particularly useful for avoiding require()
statements being
picked up, which are included at compile time.
Add special debugger
method to compiler. Compiles down to javascript
debugger
keyword to start in-browser debug console.
Add missing string escapes to read_escape
in lexer. Now most ruby escape
sequences are properly detected and handled in string parsing.
Disable escapes inside x-strings. This means no more double escaping all
characters in x-strings and backticks. (\n
=> \n
).
Add time.rb
to stdlib and moved Time.parse()
and Time.iso8601()
methods there.
!
is now treated as an unary method call on the object. Opal now parsed
!
as a def method name, and implements the method on BasicObject
,
NilClass
and Boolean
.
Fixed bug where true/false as object literals from javascript were not
correctly being detected as truthy/falsy respectively. This is due to the
javascript "feature" where new Boolean(false) !== false
.
Moved native.rb
to stdlib. Native support must now be explicitly required
into Opal. Native
is also now a module, instead of a top level class.
Also added Native::Object#respond_to?
.
Remove all core #as_json()
methods from json.rb
. Added them externally
to opal-activesupport
.
Kernel#respond_to?
now calls #respond_to_missing?
for compliance.
Fix various String
methods and add relevant rubyspecs for them. #chars
,
#to_f
, #clone
, #split
.
Fix Array
method compliance: #first
, #fetch
, #insert
, #delete_at
,
#last
, #splice
, .try_convert
.
Fix compliance of Kernel#extend
and ensure it calls #extended()
hook.
Fix bug where sometimes the wrong regexp flags would be generated in the
output javascript.
Support parsing __END__
constructs in ruby code, inside the lexer. The
content is gathered up by use of the parser. The special constant DATA
is then available inside the ruby code to read the content.
Support single character strings (using ? prefix) with escaped characters.
Fix lexer to detect dereferencing on local variables even when whitespace
is present (a = 0; a [0]
parses as a deference on a).
Fix various Struct
methods. Fixed #each
and #each_pair
to return
self. Add Struct.[]
as synonym for Struct.new
.
Implemented some Enumerable
methods: #collect_concat
, #flat_map
,
#reject
, #reverse_each
, #partition
and #zip
.
Support any Tilt template for index_path
in Opal::Server
. All index
files are now run through Tilt
(now supports haml etc).
Fix code generation of op_asgn_1
calls (foo[val] += 10
).
Add base64
to stdlib.
Add promises implementation to stdlib.
Add Math
module to corelib.
Use //#
instead of //@
deprecated syntax for sourceMappingURL.
Implicitly require erb
from stdlib when including erb templates.
Fix Regexp.escape
to also escape '(' character.
Support '<' and '>' as matching pairs in string boundrys %q<hi>
.
Opal::Server
no longer searches for an index file if not specified.
Move Math
and Encoding
to stdlib. Can be required using
require 'math'
, etc.
Fix some stdlib Date
methods.
Fix Regexp.escape
to properly escape \n, \t, \r, \f characters.
Add Regexp.quote
as an alias of escape
.
Published by elia over 10 years ago
Updated RubySpec to master and added rubysl-*
specs. Thanks to Mike Owens (@mieko)
Added Kernel#require_remote(url)
in opal-parser
that requires files with basic synchronous ajax
GET requests. It is used to load <scripts type="text/ruby" src="…url…">
.
Various parsing fixes (Hash parsing, def
returns method name, cleanup core/util
, Enumerator fixes)
Added #native_reader
, #native_writer
and #native_accessor
as class methods
donated by include Native
Added specs for Sprockets' processors (both .js.rb and .opalerb), backported from opal-rails
Set 2.1.1 as RUBY_VERSION
Add opal-build
command utility to easily build libraries to js
Add opal-repl
to gemspec executables,
previously was only available by using Opal from source
Fix parsing =>
in hash literals where it would sometimes incorrectly
parse as a key name.