opal 0.5.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +40 -9
- data/CHANGELOG.md +349 -0
- data/Gemfile +7 -8
- data/README.md +25 -3
- data/Rakefile +4 -2
- data/bin/opal +1 -1
- data/examples/rack/Gemfile +3 -0
- data/examples/rack/app/application.rb +13 -0
- data/examples/rack/app/user.rb +21 -0
- data/examples/rack/config.ru +7 -0
- data/examples/rack/index.html.erb +10 -0
- data/examples/sinatra/Gemfile +4 -0
- data/examples/sinatra/app/application.rb +7 -0
- data/examples/sinatra/config.ru +21 -0
- data/lib/mspec/opal/rake_task.rb +29 -8
- data/lib/mspec/opal/runner.rb +5 -4
- data/lib/opal.rb +1 -0
- data/lib/opal/builder.rb +0 -28
- data/lib/opal/cli.rb +0 -14
- data/lib/opal/compiler.rb +12 -11
- data/lib/opal/fragment.rb +8 -1
- data/lib/opal/nodes/array.rb +1 -1
- data/lib/opal/nodes/base.rb +4 -0
- data/lib/opal/nodes/call.rb +6 -2
- data/lib/opal/nodes/call_special.rb +1 -1
- data/lib/opal/nodes/class.rb +2 -2
- data/lib/opal/nodes/constants.rb +3 -1
- data/lib/opal/nodes/helpers.rb +23 -14
- data/lib/opal/nodes/if.rb +16 -9
- data/lib/opal/nodes/literal.rb +37 -5
- data/lib/opal/nodes/logic.rb +7 -1
- data/lib/opal/nodes/module.rb +2 -2
- data/lib/opal/nodes/scope.rb +13 -2
- data/lib/opal/nodes/top.rb +9 -0
- data/lib/opal/nodes/variables.rb +5 -2
- data/lib/opal/parser.rb +306 -71
- data/lib/opal/parser/grammar.rb +2667 -2775
- data/lib/opal/parser/grammar.y +177 -233
- data/lib/opal/parser/lexer.rb +511 -427
- data/lib/opal/parser/sexp.rb +15 -3
- data/lib/opal/source_map.rb +8 -4
- data/lib/opal/sprockets.rb +4 -0
- data/lib/opal/sprockets/cache_key_fix.rb +17 -0
- data/lib/opal/sprockets/environment.rb +21 -0
- data/lib/opal/sprockets/erb.rb +30 -0
- data/lib/opal/sprockets/processor.rb +127 -0
- data/lib/opal/sprockets/server.rb +166 -0
- data/lib/opal/util.rb +29 -0
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +1 -1
- data/opal/corelib/array.rb +106 -187
- data/opal/corelib/array/inheritance.rb +113 -0
- data/opal/corelib/basic_object.rb +6 -2
- data/opal/corelib/boolean.rb +4 -0
- data/opal/corelib/class.rb +2 -0
- data/opal/corelib/complex.rb +3 -0
- data/opal/corelib/enumerable.rb +75 -8
- data/opal/corelib/enumerator.rb +2 -0
- data/opal/corelib/error.rb +23 -23
- data/opal/corelib/hash.rb +5 -5
- data/opal/corelib/helpers.rb +51 -16
- data/opal/corelib/io.rb +7 -24
- data/opal/corelib/kernel.rb +23 -11
- data/opal/corelib/module.rb +44 -47
- data/opal/corelib/nil_class.rb +4 -0
- data/opal/corelib/numeric.rb +101 -15
- data/opal/corelib/range.rb +2 -0
- data/opal/corelib/rational.rb +3 -0
- data/opal/corelib/regexp.rb +36 -17
- data/opal/corelib/runtime.js +22 -7
- data/opal/corelib/string.rb +213 -110
- data/opal/corelib/string/inheritance.rb +78 -0
- data/opal/corelib/struct.rb +8 -0
- data/opal/corelib/time.rb +54 -42
- data/opal/corelib/variables.rb +24 -0
- data/opal/opal.rb +5 -27
- data/spec/cli/compiler_spec.rb +136 -0
- data/spec/cli/dependency_resolver_spec.rb +40 -0
- data/spec/cli/lexer_spec.rb +110 -0
- data/spec/cli/parser/alias_spec.rb +26 -0
- data/spec/cli/parser/and_spec.rb +13 -0
- data/spec/cli/parser/attrasgn_spec.rb +28 -0
- data/spec/cli/parser/begin_spec.rb +42 -0
- data/spec/cli/parser/block_spec.rb +12 -0
- data/spec/cli/parser/break_spec.rb +17 -0
- data/spec/cli/parser/call_spec.rb +139 -0
- data/spec/cli/parser/class_spec.rb +35 -0
- data/spec/cli/parser/comments_spec.rb +11 -0
- data/spec/cli/parser/def_spec.rb +61 -0
- data/spec/cli/parser/if_spec.rb +26 -0
- data/spec/cli/parser/iter_spec.rb +59 -0
- data/spec/cli/parser/lambda_spec.rb +64 -0
- data/spec/cli/parser/literal_spec.rb +113 -0
- data/spec/cli/parser/masgn_spec.rb +37 -0
- data/spec/cli/parser/module_spec.rb +27 -0
- data/spec/cli/parser/not_spec.rb +27 -0
- data/spec/cli/parser/op_asgn1_spec.rb +23 -0
- data/spec/cli/parser/op_asgn2_spec.rb +23 -0
- data/spec/cli/parser/or_spec.rb +13 -0
- data/spec/cli/parser/return_spec.rb +17 -0
- data/spec/cli/parser/sclass_spec.rb +21 -0
- data/spec/cli/parser/string_spec.rb +269 -0
- data/spec/cli/parser/super_spec.rb +20 -0
- data/spec/cli/parser/undef_spec.rb +15 -0
- data/spec/cli/parser/unless_spec.rb +13 -0
- data/spec/cli/parser/variables_spec.rb +92 -0
- data/spec/cli/parser/while_spec.rb +15 -0
- data/spec/cli/parser/yield_spec.rb +20 -0
- data/spec/cli/spec_helper.rb +31 -11
- data/spec/opal/core/array/set_range_to_array_spec.rb +7 -0
- data/spec/opal/core/date_spec.rb +122 -0
- data/spec/opal/core/language/predefined_spec.rb +1 -1
- data/spec/opal/core/runtime/operator_call_spec.rb +13 -0
- data/spec/opal/core/runtime/truthy_spec.rb +23 -0
- data/spec/opal/filters/bugs/array.rb +96 -87
- data/spec/opal/filters/bugs/basic_object.rb +9 -0
- data/spec/opal/filters/bugs/class.rb +16 -0
- data/spec/opal/filters/bugs/enumerable.rb +54 -0
- data/spec/opal/filters/bugs/language.rb +37 -3
- data/spec/opal/filters/bugs/math.rb +93 -0
- data/spec/opal/filters/bugs/nil.rb +7 -0
- data/spec/opal/filters/bugs/numeric.rb +19 -0
- data/spec/opal/filters/bugs/opal.rb +12 -0
- data/spec/opal/filters/bugs/regexp.rb +0 -2
- data/spec/opal/filters/bugs/string.rb +317 -19
- data/spec/opal/filters/bugs/struct.rb +29 -0
- data/spec/opal/filters/bugs/time.rb +130 -9
- data/spec/opal/filters/unsupported/encoding.rb +52 -4
- data/spec/opal/filters/unsupported/enumerator.rb +0 -3
- data/spec/opal/filters/unsupported/integer_size.rb +7 -0
- data/spec/opal/filters/unsupported/method_added.rb +10 -0
- data/spec/opal/filters/unsupported/mutable_strings.rb +299 -1
- data/spec/opal/filters/unsupported/private_constants.rb +30 -0
- data/spec/opal/filters/unsupported/private_methods.rb +16 -0
- data/spec/opal/filters/unsupported/random.rb +4 -0
- data/spec/opal/filters/unsupported/tainted.rb +53 -0
- data/spec/opal/filters/unsupported/trusted.rb +5 -0
- data/spec/opal/rubyspecs +167 -234
- data/spec/opal/spec_helper.rb +3 -0
- data/spec/opal/stdlib/promise/error_spec.rb +15 -0
- data/spec/opal/stdlib/promise/rescue_spec.rb +35 -0
- data/spec/opal/stdlib/promise/then_spec.rb +54 -0
- data/spec/opal/stdlib/promise/trace_spec.rb +35 -0
- data/spec/opal/stdlib/promise/value_spec.rb +15 -0
- data/spec/opal/stdlib/promise/when_spec.rb +34 -0
- data/stdlib/base64.rb +152 -0
- data/stdlib/date.rb +82 -49
- data/{opal/corelib → stdlib}/encoding.rb +3 -1
- data/stdlib/erb.rb +0 -1
- data/stdlib/json.rb +10 -26
- data/stdlib/math.rb +370 -0
- data/stdlib/native.rb +40 -33
- data/stdlib/opal-parser.rb +7 -4
- data/stdlib/promise.rb +292 -0
- data/stdlib/strscan.rb +1 -1
- data/stdlib/template.rb +1 -3
- data/stdlib/time.rb +9 -0
- metadata +143 -204
- data/doc/compiler.md +0 -42
- data/doc/compiler_options.md +0 -5
- data/doc/examples/node_http_server.rb +0 -49
- data/doc/external_libraries.md +0 -9
- data/doc/generated_javascript.md +0 -272
- data/doc/home.md +0 -17
- data/doc/method_missing.md +0 -58
- data/doc/static_applications.md +0 -60
- data/doc/using_ruby_from_javascript.md +0 -18
- data/doc/using_sprockets.md +0 -65
- data/spec/opal/core/numeric/abs_spec.rb +0 -12
- data/spec/opal/core/numeric/downto_spec.rb +0 -19
- data/spec/opal/core/numeric/equal_value_spec.rb +0 -9
- data/spec/opal/core/numeric/even_spec.rb +0 -21
- data/spec/opal/core/numeric/magnitude_spec.rb +0 -12
- data/spec/opal/core/numeric/odd_spec.rb +0 -21
- data/spec/opal/core/string/chop_spec.rb +0 -10
- data/spec/opal/core/string/chr_spec.rb +0 -13
- data/spec/opal/core/string/clone_spec.rb +0 -8
- data/spec/opal/core/string/comparison_spec.rb +0 -13
- data/spec/opal/core/string/dup_spec.rb +0 -8
- data/spec/opal/core/string/element_reference_spec.rb +0 -96
- data/spec/opal/core/string/fixtures/classes.rb +0 -49
- data/spec/opal/core/string/format_spec.rb +0 -9
- data/spec/opal/core/string/freeze_spec.rb +0 -15
- data/spec/opal/core/string/gsub_spec.rb +0 -31
- data/spec/opal/core/string/lines_spec.rb +0 -9
- data/spec/opal/core/string/ljust_spec.rb +0 -32
- data/spec/opal/core/string/lstrip_spec.rb +0 -7
- data/spec/opal/core/string/match_spec.rb +0 -49
- data/spec/opal/core/string/next_spec.rb +0 -10
- data/spec/opal/core/string/ord_spec.rb +0 -9
- data/spec/opal/core/string/partition_spec.rb +0 -10
- data/spec/opal/core/string/rindex_spec.rb +0 -50
- data/spec/opal/core/string/rjust_spec.rb +0 -32
- data/spec/opal/core/string/rstrip_spec.rb +0 -7
- data/spec/opal/core/string/scan_spec.rb +0 -66
- data/spec/opal/core/string/slice_spec.rb +0 -74
- data/spec/opal/core/string/split_spec.rb +0 -5
- data/spec/opal/core/string/strip_spec.rb +0 -6
- data/spec/opal/core/string/sub_spec.rb +0 -38
- data/spec/opal/core/string/succ_spec.rb +0 -10
- data/spec/opal/core/string/sum_spec.rb +0 -5
- data/spec/opal/core/string/to_f_spec.rb +0 -14
- data/spec/opal/core/string/to_i_spec.rb +0 -25
- data/spec/opal/core/string/tr_s_spec.rb +0 -31
- data/spec/opal/core/string/tr_spec.rb +0 -31
- data/spec/opal/filters/bugs/parser.rb +0 -10
- data/spec/opal/filters/unsupported/immutable_strings.rb +0 -24
- data/spec/opal/filters/unsupported/string_subclasses.rb +0 -8
- data/spec/opal/parser/alias_spec.rb +0 -26
- data/spec/opal/parser/and_spec.rb +0 -13
- data/spec/opal/parser/array_spec.rb +0 -22
- data/spec/opal/parser/attrasgn_spec.rb +0 -28
- data/spec/opal/parser/begin_spec.rb +0 -42
- data/spec/opal/parser/block_spec.rb +0 -12
- data/spec/opal/parser/break_spec.rb +0 -17
- data/spec/opal/parser/call_spec.rb +0 -131
- data/spec/opal/parser/class_spec.rb +0 -35
- data/spec/opal/parser/const_spec.rb +0 -13
- data/spec/opal/parser/cvar_spec.rb +0 -11
- data/spec/opal/parser/def_spec.rb +0 -61
- data/spec/opal/parser/false_spec.rb +0 -17
- data/spec/opal/parser/file_spec.rb +0 -7
- data/spec/opal/parser/gvar_spec.rb +0 -13
- data/spec/opal/parser/hash_spec.rb +0 -17
- data/spec/opal/parser/heredoc_spec.rb +0 -30
- data/spec/opal/parser/iasgn_spec.rb +0 -9
- data/spec/opal/parser/if_spec.rb +0 -26
- data/spec/opal/parser/int_spec.rb +0 -13
- data/spec/opal/parser/iter_spec.rb +0 -59
- data/spec/opal/parser/ivar_spec.rb +0 -9
- data/spec/opal/parser/lambda_spec.rb +0 -64
- data/spec/opal/parser/lasgn_spec.rb +0 -8
- data/spec/opal/parser/line_spec.rb +0 -8
- data/spec/opal/parser/lvar_spec.rb +0 -38
- data/spec/opal/parser/masgn_spec.rb +0 -37
- data/spec/opal/parser/module_spec.rb +0 -27
- data/spec/opal/parser/nil_spec.rb +0 -17
- data/spec/opal/parser/not_spec.rb +0 -27
- data/spec/opal/parser/nth_ref_spec.rb +0 -13
- data/spec/opal/parser/op_asgn1_spec.rb +0 -23
- data/spec/opal/parser/op_asgn2_spec.rb +0 -23
- data/spec/opal/parser/or_spec.rb +0 -13
- data/spec/opal/parser/parse_spec.rb +0 -66
- data/spec/opal/parser/regexp_spec.rb +0 -16
- data/spec/opal/parser/return_spec.rb +0 -17
- data/spec/opal/parser/sclass_spec.rb +0 -21
- data/spec/opal/parser/self_spec.rb +0 -17
- data/spec/opal/parser/str_spec.rb +0 -107
- data/spec/opal/parser/string_spec.rb +0 -8
- data/spec/opal/parser/super_spec.rb +0 -20
- data/spec/opal/parser/true_spec.rb +0 -17
- data/spec/opal/parser/undef_spec.rb +0 -15
- data/spec/opal/parser/unless_spec.rb +0 -13
- data/spec/opal/parser/while_spec.rb +0 -15
- data/spec/opal/parser/xstr_spec.rb +0 -116
- data/spec/opal/parser/yield_spec.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f894d4150a0535a93f352701ed5b9d204b74409
|
|
4
|
+
data.tar.gz: 1551213eccd9d9177e3868722429c56624a40b5b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a14ce6ec8c51a5a64d29c0b10865daaf426c17703f978fc99f2aad2d0bb9b2562f9de495cb1d0cf2f40281305ebe3f3cd4eb4442e68b3a92bbf9d6c5b5eb3d52
|
|
7
|
+
data.tar.gz: b697aeeca8bfee4fcc2f70bbc6fd52df6bf140938983b114e905f3d08c01ba080756e21e331301d9713b735db090f9b5b670dee7c56d64d2f7655b55c7f238d3
|
data/.travis.yml
CHANGED
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
cache: bundler
|
|
4
|
+
|
|
5
|
+
matrix:
|
|
6
|
+
fast_finish: true
|
|
7
|
+
|
|
8
|
+
include:
|
|
9
|
+
- rvm: 2.1.0
|
|
10
|
+
env: RUN=default
|
|
11
|
+
|
|
12
|
+
- rvm: 1.8.7
|
|
13
|
+
env: RUN=rspec
|
|
14
|
+
|
|
15
|
+
- rvm: 1.9.3
|
|
16
|
+
env: RUN=rspec
|
|
17
|
+
|
|
18
|
+
- rvm: 2.0.0
|
|
19
|
+
env: RUN=rspec
|
|
20
|
+
|
|
21
|
+
- rvm: rbx
|
|
22
|
+
env: RUN=rspec
|
|
23
|
+
|
|
24
|
+
- rvm: jruby
|
|
25
|
+
env: RUN=rspec
|
|
26
|
+
|
|
27
|
+
allow_failures:
|
|
28
|
+
- rvm: 1.8.7
|
|
29
|
+
- rvm: 1.9.3
|
|
30
|
+
- rvm: 2.0.0
|
|
31
|
+
- rvm: rbx
|
|
32
|
+
- rvm: jruby
|
|
8
33
|
|
|
9
34
|
before_install:
|
|
10
35
|
- git submodule update --init
|
|
11
36
|
|
|
37
|
+
# Fix waiting for rubygems v2.2.1 to be released and active on travis
|
|
38
|
+
# https://github.com/rubygems/rubygems/commit/f8e0f1d5f67cfc4e1966cc1e2db367aebf8a09e4
|
|
39
|
+
- gem update bundler
|
|
40
|
+
- bundle --version
|
|
41
|
+
- gem update --system 2.1.11
|
|
42
|
+
- gem --version
|
|
43
|
+
|
|
44
|
+
script:
|
|
45
|
+
- "bundle exec rake $RUN"
|
|
46
|
+
|
|
12
47
|
notifications:
|
|
13
48
|
irc: "irc.freenode.org#opal"
|
|
14
|
-
|
|
15
|
-
matrix:
|
|
16
|
-
allow_failures:
|
|
17
|
-
- rvm: rbx-20mode
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
## edge
|
|
2
|
+
|
|
3
|
+
* Fix parsing of escapes in single-strings ('foo\n'). Only ' and \
|
|
4
|
+
characters now get escaped in single quoted strings. Also, more escape
|
|
5
|
+
sequences in double-quoted strings are now supported: `\a`, `\v`, `\f`,
|
|
6
|
+
`\e`, `\s`, octal (`\314`), hex (`\xff`) and unicode (`\u1234`).
|
|
7
|
+
|
|
8
|
+
* Sourcemaps revamp. Lexer now tracks column and line info for ever token to
|
|
9
|
+
produce much more accurate sourcemaps. All method calls are now located on
|
|
10
|
+
the correct source line, and multi-line xstrings are now split to generate
|
|
11
|
+
a map line-to-line for long inline javascript parts.
|
|
12
|
+
|
|
13
|
+
* Merged sprockets support from `opal-sprockets` directly into Opal. For the
|
|
14
|
+
next release, the exernal `opal-sprockets` gem is no longer needed. This
|
|
15
|
+
commit adds `Opal::Processor`, `Opal::Server` and `Opal::Environment`.
|
|
16
|
+
|
|
17
|
+
* Introduce pre-processed if directives to hide code from Opal. Two special
|
|
18
|
+
constant checks now take place in the compiler. Either `RUBY_ENGINE` or
|
|
19
|
+
`RUBY_PLATFORM` when `== "opal"`. Both if and unless statements can pick
|
|
20
|
+
up these logic checks:
|
|
21
|
+
|
|
22
|
+
if RUBY_ENGINE == "opal"
|
|
23
|
+
# this code compiles
|
|
24
|
+
else
|
|
25
|
+
# this code never compiles
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Unless:
|
|
29
|
+
|
|
30
|
+
unless RUBY_ENGINE == "opal"
|
|
31
|
+
# this code never compiles
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
This is particularly useful for avoiding `require()` statements being
|
|
35
|
+
picked up, which are included at compile time.
|
|
36
|
+
|
|
37
|
+
* Add special `debugger` method to compiler. Compiles down to javascript
|
|
38
|
+
`debugger` keyword to start in-browser debug console.
|
|
39
|
+
|
|
40
|
+
* Add missing string escapes to `read_escape` in lexer. Now most ruby escape
|
|
41
|
+
sequences are properly detected and handled in string parsing.
|
|
42
|
+
|
|
43
|
+
* Disable escapes inside x-strings. This means no more double escaping all
|
|
44
|
+
characters in x-strings and backticks. (`\n` => `\n`).
|
|
45
|
+
|
|
46
|
+
* Add `time.rb` to stdlib and moved `Time.parse()` and `Time.iso8601()`
|
|
47
|
+
methods there.
|
|
48
|
+
|
|
49
|
+
* `!` is now treated as a unary method call on the object. Opal now parsed
|
|
50
|
+
`!` as a def method name, and implements the method on `BasicObject`,
|
|
51
|
+
`NilClass` and `Boolean`.
|
|
52
|
+
|
|
53
|
+
* Fixed bug where true/false as object literals from javascript were not
|
|
54
|
+
correctly being detected as truthy/falsy respectively. This is due to the
|
|
55
|
+
javascript "feature" where `new Boolean(false) !== false`.
|
|
56
|
+
|
|
57
|
+
* Moved `native.rb` to stdlib. Native support must now be explicitly required
|
|
58
|
+
into Opal. `Native` is also now a module, instead of a top level class.
|
|
59
|
+
Also added `Native::Object#respond_to?`.
|
|
60
|
+
|
|
61
|
+
* Remove all core `#as_json()` methods from `json.rb`. Added them externally
|
|
62
|
+
to `opal-activesupport`.
|
|
63
|
+
|
|
64
|
+
* `Kernel#respond_to?` now calls `#respond_to_missing?` for compliance.
|
|
65
|
+
|
|
66
|
+
* Fix various `String` methods and add relevant rubyspecs for them. `#chars`,
|
|
67
|
+
`#to_f`, `#clone`, `#split`.
|
|
68
|
+
|
|
69
|
+
* Fix `Array` method compliance: `#first`, `#fetch`, `#insert`, `#delete_at`,
|
|
70
|
+
`#last, `#splice`, `.try_convert`.
|
|
71
|
+
|
|
72
|
+
* Fix compliance of `Kernel#extend` and ensure it calls `#extended()` hook.
|
|
73
|
+
|
|
74
|
+
* Fix bug where sometimes the wrong regexp flags would be generated in the
|
|
75
|
+
output javascript.
|
|
76
|
+
|
|
77
|
+
* Support parsing `__END__` constructs in ruby code, inside the lexer. The
|
|
78
|
+
content is gathered up by use of the parser. The special constant `DATA`
|
|
79
|
+
is then available inside the ruby code to read the content.
|
|
80
|
+
|
|
81
|
+
* Support single character strings (using ? prefix) with escaped characters.
|
|
82
|
+
|
|
83
|
+
* Fix lexer to detect dereferencing on local variables even when whitespace
|
|
84
|
+
is present (`a = 0; a [0]` parses as a deference on a).
|
|
85
|
+
|
|
86
|
+
* Fix various `Struct` methods. Fixed `#each` and `#each_pair` to return
|
|
87
|
+
self. Add `Struct.[]` as synonym for `Struct.new`.
|
|
88
|
+
|
|
89
|
+
* Implemented some `Enumerable` methods: `#collect_concat`, `#flat_map`,
|
|
90
|
+
`#reject`, `#reverse_each`, `#partition` and `#zip`.
|
|
91
|
+
|
|
92
|
+
* Support any Tilt template for `index_path` in `Opal::Server`. All index
|
|
93
|
+
files are now run through `Tilt` (now supports haml etc).
|
|
94
|
+
|
|
95
|
+
* Fix code generation of `op_asgn_1` calls (foo[val] += 10).
|
|
96
|
+
|
|
97
|
+
* Add `base64` to stdlib.
|
|
98
|
+
|
|
99
|
+
* Add promises implementation to stdlib.
|
|
100
|
+
|
|
101
|
+
* Add `Math` module to corelib.
|
|
102
|
+
|
|
103
|
+
* Use `//#` instead of `//@` deprecated syntax for sourceMappingURL.
|
|
104
|
+
|
|
105
|
+
* Implicitly require `erb` from stdlib when including erb templates.
|
|
106
|
+
|
|
107
|
+
* Fix `Regexp.escape` to also escape '(' character.
|
|
108
|
+
|
|
109
|
+
* Support '<' and '>' as matching pairs in string boundrys `%q<hi>`.
|
|
110
|
+
|
|
111
|
+
* `Opal::Server` no longer searches for an index file if not specified.
|
|
112
|
+
|
|
113
|
+
* Move `Math` and `Encoding` to stdlib. Can be required using
|
|
114
|
+
`require 'math'`, etc.
|
|
115
|
+
|
|
116
|
+
* Fix some stdlib `Date` methods.
|
|
117
|
+
|
|
118
|
+
* Fix `Regexp.escape` to properly escape \n, \t, \r, \f characters.
|
|
119
|
+
|
|
120
|
+
* Add `Regexp.quote` as an alias of `escape`.
|
|
121
|
+
|
|
122
|
+
## 0.5.5 2013-11-25
|
|
123
|
+
|
|
124
|
+
* Fix regression: add `%i[foo bar]` style words back to lexer
|
|
125
|
+
|
|
126
|
+
* Move corelib from `opal/core` to `opal/corelib`. This stops files in
|
|
127
|
+
`core/` clashing with user files.
|
|
128
|
+
|
|
129
|
+
## 0.5.4 2013-11-20
|
|
130
|
+
|
|
131
|
+
* Reverted `RUBY_VERSION` to `1.9.3`. Opal `0.6.0` will be the first release
|
|
132
|
+
for `2.0.0`.
|
|
133
|
+
|
|
134
|
+
## 0.5.3 2013-11-12
|
|
135
|
+
|
|
136
|
+
* Opal now targets ruby 2.0.0
|
|
137
|
+
|
|
138
|
+
* Named function inside class body now generates with `$` prefix, e.g.
|
|
139
|
+
`$MyClass`. This makes it easier to wrap/bridge native functions.
|
|
140
|
+
|
|
141
|
+
* Support Array subclasses
|
|
142
|
+
|
|
143
|
+
* Various fixes to `String`, `Kernel` and other core classes
|
|
144
|
+
|
|
145
|
+
* Fix `Method#call` to use correct receiver
|
|
146
|
+
|
|
147
|
+
* Fix `Module#define_method` to call `#to_proc` on explicit argument
|
|
148
|
+
|
|
149
|
+
* Fix `super()` dispatches on class methods
|
|
150
|
+
|
|
151
|
+
* Support `yield()` calls from inside a block (inside a method)
|
|
152
|
+
|
|
153
|
+
* Cleanup string parsing inside lexer
|
|
154
|
+
|
|
155
|
+
* Cleanup parser/lexer to use `t` and `k` prefixes for all tokens
|
|
156
|
+
|
|
157
|
+
## 0.5.2 2013-11-11
|
|
158
|
+
|
|
159
|
+
* Include native into corelib for 0.5.x
|
|
160
|
+
|
|
161
|
+
## 0.5.1 2013-11-10
|
|
162
|
+
|
|
163
|
+
* Move all corelib under `core/` directory to prevent filename clashes with
|
|
164
|
+
`require`
|
|
165
|
+
|
|
166
|
+
* Move `native.rb` into stdlib - must now be explicitly required
|
|
167
|
+
|
|
168
|
+
* Implement `BasicObject#__id__`
|
|
169
|
+
|
|
170
|
+
* Cleanup and fix various `Enumerable` methods
|
|
171
|
+
|
|
172
|
+
## 0.5.0 2013-11-03
|
|
173
|
+
|
|
174
|
+
* WIP: https://gist.github.com/elia/7747460
|
|
175
|
+
|
|
176
|
+
## 0.4.2 2013-07-03
|
|
177
|
+
|
|
178
|
+
* Added `Kernel#rand`. (fntzr)
|
|
179
|
+
|
|
180
|
+
* Restored the `bin/opal` executable in gemspec.
|
|
181
|
+
|
|
182
|
+
* Now `.valueOf()` is used in `#to_n` of Boolean, Numeric, Regexp and String
|
|
183
|
+
to return the naked JavaScript value instead of a wrapping object.
|
|
184
|
+
|
|
185
|
+
* Parser now wraps or-ops in paranthesis to stop variable order from
|
|
186
|
+
leaking out when minified by uglify. We now have code in this
|
|
187
|
+
format: `(((tmp = lhs) !== false || !==nil) ? tmp : rhs)`.
|
|
188
|
+
|
|
189
|
+
## 0.4.1 2013-06-16
|
|
190
|
+
|
|
191
|
+
* Move sprockets logic out to external opal-sprockets gem. That now
|
|
192
|
+
handles the compiling and loading of opal files in sprockets.
|
|
193
|
+
|
|
194
|
+
## 0.4.0 2013-06-15
|
|
195
|
+
|
|
196
|
+
* Added fragments to parser. All parser methods now generate one or
|
|
197
|
+
more Fragments which store the original sexp. This allows us to
|
|
198
|
+
enumerate over them after parsing to map generated lines back to
|
|
199
|
+
original line numbers.
|
|
200
|
+
|
|
201
|
+
* Reverted `null` for `nil`. Too buggy at this time.
|
|
202
|
+
|
|
203
|
+
* Add Opal::SprocketsParser as Parser subclass for handling parsing
|
|
204
|
+
for sprockets environment. This subclass handles require statements
|
|
205
|
+
and stores them for sprockets to use.
|
|
206
|
+
|
|
207
|
+
* Add :irb option to parser to keep top level lvars stored inside
|
|
208
|
+
opal runtime so that an irb session can be persisted and maintain
|
|
209
|
+
access to local variables.
|
|
210
|
+
|
|
211
|
+
* Add Opal::Environment#use_gem() helper to add a gem to opals load
|
|
212
|
+
path.
|
|
213
|
+
|
|
214
|
+
* Stop pre-setting ivars to `nil`. This is no longer needed as `nil`
|
|
215
|
+
is now `null` or `undefined`.
|
|
216
|
+
|
|
217
|
+
* Use `null` as `nil` in opal. This allows us to send methods to
|
|
218
|
+
`null` and `undefined`, and both act as `nil`. This makes opal a
|
|
219
|
+
much better javascript citizen. **REVERTED**
|
|
220
|
+
|
|
221
|
+
* Add Enumerable#none? with specs.
|
|
222
|
+
|
|
223
|
+
* Add Opal.block_send() runtime helper for sending methods to an
|
|
224
|
+
object which uses a block.
|
|
225
|
+
|
|
226
|
+
* Remove \_klass variable for denoting ruby classes, and use
|
|
227
|
+
constructor instead. constructor is a javascript property used for
|
|
228
|
+
the same purpose, and this makes opal fit in as a better js citizen.
|
|
229
|
+
|
|
230
|
+
* Add Class.bridge\_class method to bridge a native constructor into an
|
|
231
|
+
opal class which will set it up with all methods from Object, as
|
|
232
|
+
well as giving it a scope and name.
|
|
233
|
+
|
|
234
|
+
* Added native #[]= and #to_h methods, for setting properties and
|
|
235
|
+
converting to a hash respectivaly.
|
|
236
|
+
|
|
237
|
+
* Fix bug where '::' was parsed as :colon2 instead of :colon3 when in
|
|
238
|
+
an args scope. Fixes #213
|
|
239
|
+
|
|
240
|
+
* Remove lots of properties added to opal classes. This makes normal
|
|
241
|
+
js constructors a lot closer to opal classes, making is easier to
|
|
242
|
+
treat js classes as opal classes.
|
|
243
|
+
|
|
244
|
+
* Merge Hash.from_native into Hash.new
|
|
245
|
+
|
|
246
|
+
## 0.3.44 2013-05-31
|
|
247
|
+
|
|
248
|
+
* Cleanup runtime, and remove various flags and functions from opal
|
|
249
|
+
objects and classes (moving them to runtime methods).
|
|
250
|
+
|
|
251
|
+
* Remove some activesupport methods into external lib.
|
|
252
|
+
|
|
253
|
+
* Add/fix lots of String methods, with specs.
|
|
254
|
+
|
|
255
|
+
* Add more methods to MatchData class.
|
|
256
|
+
|
|
257
|
+
* Implement $' and $` variables.
|
|
258
|
+
|
|
259
|
+
* Opal can now call methods on all native objects, via method missing
|
|
260
|
+
dispatcher.
|
|
261
|
+
|
|
262
|
+
* Add Opal::Environment as custom sprockets subclass which adds all
|
|
263
|
+
opal load paths automatically.
|
|
264
|
+
|
|
265
|
+
## 0.3.43 2013-05-02
|
|
266
|
+
|
|
267
|
+
* Stop inlining respond_to? inside the parser. This now fully respects
|
|
268
|
+
an object overriding respond_to?.
|
|
269
|
+
|
|
270
|
+
* Expose `Opal.eval()` function when parser is loaded for parsing
|
|
271
|
+
and running strings of ruby code.
|
|
272
|
+
|
|
273
|
+
* Add erb to corelib (as well as compiler to gem lib). ERB files with
|
|
274
|
+
.opalerb extension will automatically be compiled into Template
|
|
275
|
+
constant.
|
|
276
|
+
|
|
277
|
+
* Added some examples into examples/ dir.
|
|
278
|
+
|
|
279
|
+
* Add Opal.send() javascript function for sending methods to ruby
|
|
280
|
+
objects.
|
|
281
|
+
|
|
282
|
+
* Native class for wrapping and interacting with native objects and
|
|
283
|
+
function calls.
|
|
284
|
+
|
|
285
|
+
* Add local_storage to stdlib as a basic wrapper around localStorage.
|
|
286
|
+
|
|
287
|
+
* Make method_missing more performant by reusing same dispatch function
|
|
288
|
+
instead of reallocating one for each run.
|
|
289
|
+
|
|
290
|
+
* Fix Kernel#format to work in firefox. String.prototype.replace() had
|
|
291
|
+
different semantics for empty matching groups which was breaking
|
|
292
|
+
Kernel#format.
|
|
293
|
+
|
|
294
|
+
## 0.3.42 2013-03-21
|
|
295
|
+
|
|
296
|
+
* Fix/add lots of language specs.
|
|
297
|
+
|
|
298
|
+
* Seperate sprockets support out to opal-sprockets gem.
|
|
299
|
+
|
|
300
|
+
* Support %r[foo] style regexps.
|
|
301
|
+
|
|
302
|
+
* Use mspec to run specs on corelib and runtime. Rubyspecs are now
|
|
303
|
+
used, where possible to be as compliant as possible.
|
|
304
|
+
|
|
305
|
+
## 0.3.41 2013-02-26
|
|
306
|
+
|
|
307
|
+
* Remove bin/opal - no longer required for building sources.
|
|
308
|
+
|
|
309
|
+
* Depreceate Opal::Environment. The Opal::Server class provides a better
|
|
310
|
+
method of using the opal load paths. Opal.paths still stores a list of
|
|
311
|
+
load paths for generic sprockets based apps to use.
|
|
312
|
+
|
|
313
|
+
## 0.3.40 2013-02-23
|
|
314
|
+
|
|
315
|
+
* Add Opal::Server as an easy to configure rack server for testing and
|
|
316
|
+
running Opal based apps.
|
|
317
|
+
|
|
318
|
+
* Added optional arity check mode for parser. When turned on, every method
|
|
319
|
+
will have code which checks the argument arity. Off by default.
|
|
320
|
+
|
|
321
|
+
* Exception subclasses now relfect their name in webkit/firefox debuggers
|
|
322
|
+
to show both their class name and message.
|
|
323
|
+
|
|
324
|
+
* Add Class#const_set. Trying to access undefined constants by a literal
|
|
325
|
+
constant will now also raise a NameError.
|
|
326
|
+
|
|
327
|
+
## 0.3.39 2013-02-20
|
|
328
|
+
|
|
329
|
+
* Fix bug where methods defined on a parent class after subclass was defined
|
|
330
|
+
would not given subclass access to method. Subclasses are now also tracked
|
|
331
|
+
by superclass, by a private '_inherited' property.
|
|
332
|
+
|
|
333
|
+
* Fix bug where classes defined by `Class.new` did not have a constant scope.
|
|
334
|
+
|
|
335
|
+
* Move Date out of opal.rb loading, as it is part of stdlib not corelib.
|
|
336
|
+
|
|
337
|
+
* Fix for defining methods inside metaclass, or singleton_class scopes.
|
|
338
|
+
|
|
339
|
+
## 0.3.38 2013-02-13
|
|
340
|
+
|
|
341
|
+
* Add Native module used for wrapping objects to forward calls as native
|
|
342
|
+
calls.
|
|
343
|
+
|
|
344
|
+
* Support method_missing for all objects. Feature can be enabled/disabled on
|
|
345
|
+
Opal::Processor.
|
|
346
|
+
|
|
347
|
+
* Hash can now use any ruby object as a key.
|
|
348
|
+
|
|
349
|
+
* Move to Sprockets based building via `Opal::Processor`.
|
data/Gemfile
CHANGED
|
@@ -3,15 +3,14 @@ gemspec
|
|
|
3
3
|
|
|
4
4
|
# Stick with older racc until
|
|
5
5
|
# https://github.com/tenderlove/racc/issues/32
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
end
|
|
6
|
+
# and
|
|
7
|
+
# https://github.com/tenderlove/racc/issues/22
|
|
8
|
+
# are solved.
|
|
9
|
+
gem 'racc', '< 1.4.10' if RUBY_VERSION.to_f < 1.9 or RUBY_ENGINE == 'jruby'
|
|
10
|
+
gem 'json', '< 1.8.1' if RUBY_VERSION.to_f == 2.1 and RUBY_ENGINE == 'ruby'
|
|
11
|
+
gem 'rubysl', :platform => :rbx
|
|
13
12
|
|
|
14
13
|
group :repl do
|
|
15
|
-
gem 'therubyracer', :
|
|
14
|
+
gem 'therubyracer', :platform => :mri, :require => 'v8'
|
|
16
15
|
gem 'therubyrhino', :platform => :jruby
|
|
17
16
|
end
|
data/README.md
CHANGED
|
@@ -8,7 +8,10 @@ Opal is a ruby to javascript source-to-source compiler. It also has an
|
|
|
8
8
|
implementation of the ruby corelib.
|
|
9
9
|
|
|
10
10
|
Opal is [hosted on github](http://github.com/opal/opal), and there
|
|
11
|
-
is a Freenode IRC channel at [#opal](http://webchat.freenode.net/?channels=opal)
|
|
11
|
+
is a Freenode IRC channel at [#opal](http://webchat.freenode.net/?channels=opal),
|
|
12
|
+
ask questions on [stackoverflow#opalrb](http://stackoverflow.com/questions/ask?tags=opalrb).
|
|
13
|
+
|
|
14
|
+
|
|
12
15
|
|
|
13
16
|
## Usage
|
|
14
17
|
|
|
@@ -92,9 +95,28 @@ StringScanner, Date, etc.
|
|
|
92
95
|
|
|
93
96
|
### spec
|
|
94
97
|
|
|
95
|
-
* **rubyspec** contains rubyspecs that apply to opal (core + language)
|
|
96
98
|
* **opal** opal additions/special behaviour in the runtime/corelib
|
|
97
|
-
* **
|
|
99
|
+
* **cli** specs for opal lib (parser, lexer, grammar, compiler etc)
|
|
100
|
+
|
|
101
|
+
## Browser support
|
|
102
|
+
|
|
103
|
+
* Internet Explorer 6+
|
|
104
|
+
* Firefox (Current - 1) or Current
|
|
105
|
+
* Chrome (Current - 1) or Current
|
|
106
|
+
* Safari 5.1+
|
|
107
|
+
* Opera 12.1x or (Current - 1) or Current
|
|
108
|
+
|
|
109
|
+
Any problem above browsers should be considered and reported as a bug.
|
|
110
|
+
|
|
111
|
+
(Current - 1) or Current denotes that we support the current stable version of
|
|
112
|
+
the browser and the version that preceded it. For example, if the current
|
|
113
|
+
version of a browser is 24.x, we support the 24.x and 23.x versions.
|
|
114
|
+
|
|
115
|
+
12.1x or (Current - 1) or Current denotes that we support Opera 12.1x as well
|
|
116
|
+
as last 2 versions of Opera. For example, if the current Opera version is 20.x,
|
|
117
|
+
we support Opera 12.1x, 19.x and 20.x but not Opera 15.x through 18.x.
|
|
118
|
+
|
|
119
|
+
Cross-browser testing sponsored by [BrowserStack](http://browserstack.com).
|
|
98
120
|
|
|
99
121
|
## License
|
|
100
122
|
|