opal 1.1.0.rc1 → 1.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +4 -4
- data/.github/ISSUE_TEMPLATE/bug-report.md +47 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/build.yml +11 -5
- data/.gitignore +1 -0
- data/.jshintrc +1 -1
- data/CHANGELOG.md +42 -1
- data/Gemfile +0 -4
- data/HACKING.md +1 -1
- data/LICENSE +1 -1
- data/README.md +20 -16
- data/UNRELEASED.md +32 -95
- data/benchmark-ips/bm_array_unshift.rb +7 -0
- data/benchmark-ips/bm_js_symbols_vs_strings.rb +7 -2
- data/bin/build-browser-source-map-support +2 -3
- data/bin/opal-mspec +2 -0
- data/docs/compiler.md +1 -1
- data/examples/rack/Gemfile +0 -1
- data/examples/rack/Gemfile.lock +0 -4
- data/lib/opal/cli.rb +1 -0
- data/lib/opal/cli_options.rb +4 -0
- data/lib/opal/cli_runners/nodejs.rb +5 -1
- data/lib/opal/cli_runners/source-map-support-browser.js +8 -2
- data/lib/opal/cli_runners/source-map-support-node.js +3706 -0
- data/lib/opal/cli_runners/source-map-support.js +3 -1
- data/lib/opal/compiler.rb +2 -2
- data/lib/opal/nodes/args/arity_check.rb +1 -0
- data/lib/opal/nodes/args/parameters.rb +6 -0
- data/lib/opal/nodes/class.rb +1 -13
- data/lib/opal/nodes/literal.rb +14 -7
- data/lib/opal/nodes/module.rb +13 -9
- data/lib/opal/nodes/variables.rb +13 -4
- data/lib/opal/nodes/while.rb +54 -17
- data/lib/opal/parser.rb +1 -5
- data/lib/opal/parser/patch.rb +34 -0
- data/lib/opal/repl.rb +7 -0
- data/lib/opal/rewriter.rb +2 -0
- data/lib/opal/rewriters/arguments.rb +4 -1
- data/lib/opal/rewriters/forward_args.rb +54 -0
- data/lib/opal/rewriters/logical_operator_assignment.rb +5 -2
- data/lib/opal/rewriters/opal_engine_check.rb +5 -7
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +1 -1
- data/opal/corelib/array.rb +42 -20
- data/opal/corelib/array/pack.rb +6 -1
- data/opal/corelib/complex.rb +2 -0
- data/opal/corelib/constants.rb +3 -3
- data/opal/corelib/hash.rb +36 -38
- data/opal/corelib/module.rb +2 -7
- data/opal/corelib/number.rb +2 -180
- data/opal/corelib/numeric.rb +156 -0
- data/opal/corelib/object_space.rb +102 -0
- data/opal/corelib/random.rb +31 -66
- data/opal/corelib/random/formatter.rb +122 -0
- data/opal/corelib/range.rb +50 -19
- data/opal/corelib/runtime.js +82 -21
- data/opal/corelib/string.rb +86 -52
- data/opal/corelib/string/encoding.rb +140 -25
- data/opal/corelib/string/unpack.rb +26 -40
- data/opal/opal.rb +1 -0
- data/opal/opal/full.rb +1 -0
- data/package.json +1 -1
- data/spec/filters/bugs/array.rb +0 -22
- data/spec/filters/bugs/basicobject.rb +3 -0
- data/spec/filters/bugs/encoding.rb +0 -2
- data/spec/filters/bugs/exception.rb +1 -0
- data/spec/filters/bugs/float.rb +0 -2
- data/spec/filters/bugs/hash.rb +2 -7
- data/spec/filters/bugs/integer.rb +0 -2
- data/spec/filters/bugs/kernel.rb +16 -3
- data/spec/filters/bugs/language.rb +6 -14
- data/spec/filters/bugs/marshal.rb +1 -3
- data/spec/filters/bugs/module.rb +16 -1
- data/spec/filters/bugs/numeric.rb +4 -12
- data/spec/filters/bugs/objectspace.rb +67 -0
- data/spec/filters/bugs/pack_unpack.rb +0 -9
- data/spec/filters/bugs/pathname.rb +1 -0
- data/spec/filters/bugs/proc.rb +8 -0
- data/spec/filters/bugs/random.rb +3 -6
- data/spec/filters/bugs/range.rb +83 -113
- data/spec/filters/bugs/set.rb +2 -0
- data/spec/filters/bugs/string.rb +31 -70
- data/spec/filters/bugs/struct.rb +2 -0
- data/spec/filters/bugs/time.rb +8 -2
- data/spec/filters/unsupported/float.rb +3 -0
- data/spec/filters/unsupported/freeze.rb +1 -0
- data/spec/filters/unsupported/integer.rb +3 -0
- data/spec/filters/unsupported/refinements.rb +5 -0
- data/spec/filters/unsupported/string.rb +100 -95
- data/spec/filters/unsupported/time.rb +4 -0
- data/spec/lib/compiler_spec.rb +16 -0
- data/spec/lib/rewriters/forward_args_spec.rb +61 -0
- data/spec/lib/rewriters/logical_operator_assignment_spec.rb +1 -1
- data/spec/lib/rewriters/numblocks_spec.rb +44 -0
- data/spec/lib/rewriters/opal_engine_check_spec.rb +49 -4
- data/spec/opal/core/language/forward_args_spec.rb +53 -0
- data/spec/opal/core/language/infinite_range_spec.rb +13 -0
- data/spec/opal/core/language/memoization_spec.rb +16 -0
- data/spec/opal/core/module_spec.rb +38 -2
- data/spec/opal/core/number/to_i_spec.rb +28 -0
- data/spec/opal/core/runtime/bridged_classes_spec.rb +16 -0
- data/spec/opal/core/runtime/constants_spec.rb +20 -1
- data/spec/opal/core/string/subclassing_spec.rb +16 -0
- data/spec/opal/core/string/unpack_spec.rb +22 -0
- data/spec/opal/core/string_spec.rb +4 -4
- data/spec/ruby_specs +4 -1
- data/stdlib/json.rb +3 -1
- data/stdlib/securerandom.rb +55 -35
- data/tasks/testing.rake +6 -3
- data/test/nodejs/test_string.rb +25 -0
- data/vendored-minitest/minitest/assertions.rb +2 -0
- metadata +35 -12
- data/lib/opal/parser/with_c_lexer.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a574a86358acd4f97b91deecaa9395068503a2198c6a8b646ee5b9df35a8d5c
|
4
|
+
data.tar.gz: 800255837fc95ecbfa4268c4a4b21df99ad1fb427fe4b90a5100bbed75833791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 471561bdda1f595110d95be228b6caad444b0064e84b13d37c250c70b1e505e897c6f9f69c93afa11b13a268b98acef4d62508ba19ac1304d3c5d8178563b10f
|
7
|
+
data.tar.gz: 4620c4fc0ee08df1840300b1b03fe3cedabee19dc22c986b7151538b211da69046c4b164c8bd4145c16e4d54307376314a4514b9b95fb540fc0e37fdb8671511
|
data/.codeclimate.yml
CHANGED
@@ -9,13 +9,13 @@ checks:
|
|
9
9
|
threshold: 10
|
10
10
|
file-lines:
|
11
11
|
config:
|
12
|
-
threshold:
|
12
|
+
threshold: 1000
|
13
13
|
method-complexity:
|
14
14
|
config:
|
15
15
|
threshold: 5
|
16
16
|
method-count:
|
17
17
|
config:
|
18
|
-
threshold:
|
18
|
+
threshold: 100
|
19
19
|
method-lines:
|
20
20
|
config:
|
21
21
|
threshold: 30
|
@@ -39,6 +39,7 @@ plugins:
|
|
39
39
|
|
40
40
|
exclude_patterns:
|
41
41
|
- "benchmark/*"
|
42
|
+
- "benchmark-ips/*"
|
42
43
|
- "build/*"
|
43
44
|
- "coverage/*"
|
44
45
|
- "docs/*"
|
@@ -50,5 +51,4 @@ exclude_patterns:
|
|
50
51
|
- "**/node_modules/*"
|
51
52
|
- stdlib/nodejs/js-yaml-3-6-1.js
|
52
53
|
- lib/opal/source_map/vlq.rb
|
53
|
-
- lib/opal/cli_runners/source-map-support
|
54
|
-
- lib/opal/cli_runners/source-map-support-browser.js
|
54
|
+
- lib/opal/cli_runners/source-map-support*.js
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: 'Bug: '
|
5
|
+
labels: bug
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Describe the bug**
|
11
|
+
<!-- A clear and concise description of what the bug is.
|
12
|
+
Please clarify if it's a missing feature. -->
|
13
|
+
|
14
|
+
Opal version: …
|
15
|
+
|
16
|
+
|
17
|
+
**To Reproduce**
|
18
|
+
|
19
|
+
<!--
|
20
|
+
Steps to reproduce the behavior.
|
21
|
+
|
22
|
+
You can contrasting it to Ruby's behavior:
|
23
|
+
|
24
|
+
```
|
25
|
+
$ opal -v -e "puts 123"
|
26
|
+
123
|
27
|
+
```
|
28
|
+
|
29
|
+
```
|
30
|
+
$ruby -v -e "puts 123"
|
31
|
+
```
|
32
|
+
|
33
|
+
or show an error in the compiled code:
|
34
|
+
|
35
|
+
```
|
36
|
+
$ opal -v -e "puts 123" -cEO
|
37
|
+
…
|
38
|
+
/* Generated by Opal 1.1.1 */
|
39
|
+
(function(Opal) {
|
40
|
+
var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$, $$ = Opal.$$;
|
41
|
+
|
42
|
+
Opal.add_stubs(['$puts']);
|
43
|
+
return self.$puts(123)
|
44
|
+
})(Opal);
|
45
|
+
…
|
46
|
+
```
|
47
|
+
-->
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: 'Feature: '
|
5
|
+
labels: feature
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
12
|
+
|
13
|
+
**Describe the solution you'd like**
|
14
|
+
A clear and concise description of what you want to happen.
|
15
|
+
|
16
|
+
**Describe alternatives you've considered**
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
18
|
+
|
19
|
+
**Additional context**
|
20
|
+
Add any other context or screenshots about the feature request here.
|
data/.github/workflows/build.yml
CHANGED
@@ -6,9 +6,7 @@ on:
|
|
6
6
|
- master
|
7
7
|
- "*-stable"
|
8
8
|
- "*/ci-check"
|
9
|
-
pull_request:
|
10
|
-
branches:
|
11
|
-
- master
|
9
|
+
pull_request: {}
|
12
10
|
|
13
11
|
jobs:
|
14
12
|
rake:
|
@@ -26,14 +24,18 @@ jobs:
|
|
26
24
|
- name: minitest
|
27
25
|
ruby: 3.0
|
28
26
|
command: bin/rake minitest
|
27
|
+
- name: minitest-strict-mode
|
28
|
+
ruby: 3.0
|
29
|
+
command: bin/rake minitest
|
30
|
+
strict: 'true'
|
29
31
|
- name: current-ruby
|
30
32
|
ruby: 3.0
|
31
33
|
- name: previous-ruby
|
32
34
|
ruby: 2.7
|
33
35
|
- name: older-ruby
|
34
36
|
ruby: 2.6
|
35
|
-
- name: near-eol-ruby
|
36
|
-
|
37
|
+
# - name: near-eol-ruby
|
38
|
+
# ruby: 2.6
|
37
39
|
- name: smoke-test
|
38
40
|
ruby: 3.0
|
39
41
|
command: bin/rake smoke_test
|
@@ -87,4 +89,8 @@ jobs:
|
|
87
89
|
bundle config path $PWD/vendor/bundle
|
88
90
|
bundle install --jobs 4 --retry 3
|
89
91
|
bundle clean
|
92
|
+
- name: set environment variables
|
93
|
+
if: ${{ matrix.combo.strict == 'true' }}
|
94
|
+
run: |
|
95
|
+
echo "USE_STRICT=true" >> $GITHUB_ENV
|
90
96
|
- run: ${{ matrix.combo.command || 'bin/rake rspec' }}
|
data/.gitignore
CHANGED
data/.jshintrc
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"undef" : true, // Prohibit the use of explicitly undeclared variables
|
11
11
|
"unused" : true, // Warn when you define and never use your variables
|
12
12
|
|
13
|
-
"predef" : ["Opal", "JSON", "Java", "OpalNode", "jsyaml", "globalThis"],
|
13
|
+
"predef" : ["Opal", "JSON", "Java", "OpalNode", "jsyaml", "globalThis", "FinalizationRegistry", "WeakMap"],
|
14
14
|
|
15
15
|
"browser": true,
|
16
16
|
"node": true,
|
data/CHANGELOG.md
CHANGED
@@ -15,7 +15,17 @@ Changes are grouped as follows:
|
|
15
15
|
|
16
16
|
|
17
17
|
|
18
|
-
## [
|
18
|
+
## [1.1.1](https://github.com/opal/opal/compare/v1.1.0...v1.1.1) - 2021-02-23
|
19
|
+
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
- The default runner (nodejs) wasn't starting to a bad require in the improved stack-traces ([#2182](https://github.com/opal/opal/pull/2182))
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
## [1.1.0](https://github.com/opal/opal/compare/v1.0.5...v1.1.0) - 2021-02-19
|
19
29
|
|
20
30
|
|
21
31
|
### Added
|
@@ -36,6 +46,14 @@ Changes are grouped as follows:
|
|
36
46
|
- Added a generic implementation of Kernel#caller and #warn(uplevel:) that works with sourcemaps in Node.js and Chrome ([#2065](https://github.com/opal/opal/pull/2065))
|
37
47
|
- Added support for numblocks `-> { _1 + _2 }.call(3, 4) # => 7` ([#2149](https://github.com/opal/opal/pull/2149))
|
38
48
|
- Support `<internal:…>` and `<js:…>` in stacktraces, like MRI we now distinguish internal lines from lib/app lines ([#2154](https://github.com/opal/opal/pull/2154))
|
49
|
+
- `Array#difference`, `Array#intersection`, `Array#union` as aliases respectively to `Array#{-,&,|}` ([#2151](https://github.com/opal/opal/pull/2151))
|
50
|
+
- Aliases `filter{,!}` to `select{,!}` throughout the corelib classes ([#2151](https://github.com/opal/opal/pull/2151))
|
51
|
+
- `Enumerable#filter_map`, `Enumerable#tally` ([#2151](https://github.com/opal/opal/pull/2151))
|
52
|
+
- Alias `Kernel#then` for `Kernel#yield_self` ([#2151](https://github.com/opal/opal/pull/2151))
|
53
|
+
- Method chaining: `{Proc,Method}#{<<,>>}` ([#2151](https://github.com/opal/opal/pull/2151))
|
54
|
+
- Added Integer#to_d ([#2006](https://github.com/opal/opal/pull/2006))
|
55
|
+
- Added a compiler option `use_strict` which can also be set by the `use_strict` magic comment ([#1959](https://github.com/opal/opal/pull/1959))
|
56
|
+
- Add `--rbrequire (-q)` option to `opal` command line executable ([#2120](https://github.com/opal/opal/pull/2120))
|
39
57
|
|
40
58
|
### Fixed
|
41
59
|
|
@@ -55,6 +73,7 @@ Changes are grouped as follows:
|
|
55
73
|
- Set#keep_if ([#1987](https://github.com/opal/opal/pull/1987))
|
56
74
|
- Set#select! ([#1987](https://github.com/opal/opal/pull/1987))
|
57
75
|
- Set#reject! ([#1987](https://github.com/opal/opal/pull/1987))
|
76
|
+
- String#unicode_normalize ([#2175](https://github.com/opal/opal/pull/2175))
|
58
77
|
- Module#alias_method ([#1983](https://github.com/opal/opal/pull/1983))
|
59
78
|
- Enumerable#minmax_by ([#1981](https://github.com/opal/opal/pull/1981))
|
60
79
|
- Enumerator#each_with_index ([#1990](https://github.com/opal/opal/pull/1990))
|
@@ -72,6 +91,21 @@ Changes are grouped as follows:
|
|
72
91
|
- Set match on StringScanner#skip and StringScanner#scan_until ([#2061](https://github.com/opal/opal/pull/2061))
|
73
92
|
- Fix ruby 2.7 warnings ([#2071](https://github.com/opal/opal/pull/2071))
|
74
93
|
- Improve the --help descriptions ([#2146](https://github.com/opal/opal/pull/2146))
|
94
|
+
- Remove BasicObject#class ([#2166](https://github.com/opal/opal/pull/2166))
|
95
|
+
- Time#strftime %j leading zeros ([#2161](https://github.com/opal/opal/pull/2161))
|
96
|
+
- Fix `call { true or next }` producing invalid code ([#2160](https://github.com/opal/opal/pull/2160))
|
97
|
+
- `define_method` can now be called on the main object ([#2029](https://github.com/opal/opal/pull/2029))
|
98
|
+
- Fix nested for-loops ([#2033](https://github.com/opal/opal/pull/2033))
|
99
|
+
- Fix Number#round for Integers ([#2030](https://github.com/opal/opal/pull/2030))
|
100
|
+
- Fix parsing Unicode characters from Opal ([#2073](https://github.com/opal/opal/pull/2073))
|
101
|
+
- Integer#===: improve Integer recognition ([#2089](https://github.com/opal/opal/pull/2089))
|
102
|
+
- Regexp: ensure ignoreCase is never undefined ([#2098](https://github.com/opal/opal/pull/2098))
|
103
|
+
- Hash#delete: ensure String keys are converted to values ([#2106](https://github.com/opal/opal/pull/2106))
|
104
|
+
- Array#shift: improve performance on v8 >7.1 ([#2115](https://github.com/opal/opal/pull/2115))
|
105
|
+
- Array#pop(1): improve performance ([#2130](https://github.com/opal/opal/pull/2130))
|
106
|
+
- Object#pretty_inspect ([#2139](https://github.com/opal/opal/pull/2139))
|
107
|
+
- Fix conversion from UTF-8 to bytes ([#2138](https://github.com/opal/opal/pull/2138))
|
108
|
+
- Restore compatibility with Chrome 38, used by Cordova and many mobile browsers ([#2109](https://github.com/opal/opal/pull/2109))
|
75
109
|
|
76
110
|
### Changed
|
77
111
|
|
@@ -86,6 +120,12 @@ Changes are grouped as follows:
|
|
86
120
|
- Change parser to 3.0 ([#2148](https://github.com/opal/opal/pull/2148))
|
87
121
|
- Fix forwarding a rescued error to a global var: `rescue => $gvar` ([#2154](https://github.com/opal/opal/pull/2154))
|
88
122
|
- Now using Parser v3.0 and targeting Ruby 3.0 ([#2156](https://github.com/opal/opal/pull/2156))
|
123
|
+
- `Comparable#clamp` to support a Range argument ([#2151](https://github.com/opal/opal/pull/2151))
|
124
|
+
- `#to_h` method to support a block (shortform for `.map(&block).to_h`) ([#2151](https://github.com/opal/opal/pull/2151))
|
125
|
+
- BigDecimal is now a subclass of Numeric ([#2006](https://github.com/opal/opal/pull/2006))
|
126
|
+
- PP to be rebased on upstream Ruby version ([#2083](https://github.com/opal/opal/pull/2083))
|
127
|
+
- String to report UTF-8 encoding by default, as MRI does ([#2117](https://github.com/opal/opal/pull/2117))
|
128
|
+
- Don't output "Failed to load WithCLexer, using pure Ruby lexer" warning unless in $DEBUG mode ([#2174](https://github.com/opal/opal/pull/2174))
|
89
129
|
|
90
130
|
### Deprecated
|
91
131
|
|
@@ -96,6 +136,7 @@ Changes are grouped as follows:
|
|
96
136
|
### Removed
|
97
137
|
|
98
138
|
- Removed special compilation for the `Opal.truthy?` and `Opal.falsy?` helpers ([#2076](https://github.com/opal/opal/pull/2076))
|
139
|
+
- Removed the deprecated `tainting` compiler config option ([#2072](https://github.com/opal/opal/pull/2072))
|
99
140
|
|
100
141
|
|
101
142
|
|
data/Gemfile
CHANGED
data/HACKING.md
CHANGED
@@ -33,7 +33,7 @@ Before making changes to Opal source, you need to understand a little about how
|
|
33
33
|
|
34
34
|
Navigating to `spec/ruby/core` directory, you see that it contains multiple sub-directories, usually named after the Ruby class or module. Drilling further down into `spec/ruby/core/string` you see all the spec files for the various `String` behaviors under test, usually named by a method name followed by `_spec.rb`. Opening `spec/ruby/core/string/sub_spec.rb` you finally see the code that checks the correctness of Opal's implementation of the `String#sub` method's behavior.
|
35
35
|
|
36
|
-
When you execute `$ bundle exec rake`, the code in this file is executed, along with all the other specs in the entire test suite. It's a good idea to run the entire test suite when you feel you reached a certain milestone in the course of making your changes (exactly what that means is up to you), and definitely do `$ bundle exec rake` before
|
36
|
+
When you execute `$ bundle exec rake`, the code in this file is executed, along with all the other specs in the entire test suite. It's a good idea to run the entire test suite when you feel you reached a certain milestone in the course of making your changes (exactly what that means is up to you), and definitely do `$ bundle exec rake` before committing your changes to make sure they have not introduced regressions or other unintended side effects.
|
37
37
|
|
38
38
|
But you will want to run tests as often as possible, after every small change, and running the entire test suite will slow you down. You need to be able to execute a single spec that is concerned with the feature you are currently working on. To accomplish this, just add `PATTERN` to your spec invocation command, like this:
|
39
39
|
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (C) 2013-
|
1
|
+
Copyright (C) 2013-2021 by Adam Beynon and the Opal contributors
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
align="center" title="Opal logo by Elia Schito" width="105" height="105" />
|
4
4
|
<br/>
|
5
5
|
Opal <br/>
|
6
|
-
<img src="https://img.shields.io/badge/Opal-Ruby%20💛%20JavaScript-yellow.svg?logo=ruby&style=social&logoColor=777"/>
|
6
|
+
<img src="https://img.shields.io/badge/Opal-Ruby%20💛%20JavaScript-yellow.svg?logo=ruby&style=social&logoColor=777" alt="Opal-Ruby 💛 JavaScript"/>
|
7
7
|
</h1>
|
8
8
|
|
9
9
|
<p align="center">
|
@@ -16,19 +16,19 @@
|
|
16
16
|
<a href="https://stackoverflow.com/questions/ask?tags=opalrb"><img src="https://img.shields.io/badge/stackoverflow-%23opalrb-orange.svg?style=flat" alt="Stack Overflow" title="" /></a>
|
17
17
|
<a href="#backers"><img src="https://opencollective.com/opal/backers/badge.svg" alt="Backers on Open Collective" title="" /></a>
|
18
18
|
<a href="#sponsors"><img src="https://opencollective.com/opal/sponsors/badge.svg" alt="Sponsors on Open Collective" title="" /></a>
|
19
|
-
<a href="https://
|
19
|
+
<a href="https://slack.opalrb.com/"><img src="https://img.shields.io/badge/slack-join%20chat-46BC99?logo=slack&style=flat" alt="Slack" title="Join Chat" /></a>
|
20
20
|
<a href="https://opalrb.com/docs"><img src="https://img.shields.io/badge/docs-updated-blue.svg" alt="Documentation" title="" /></a>
|
21
21
|
|
22
22
|
<br>
|
23
23
|
<strong>Code:</strong><br>
|
24
24
|
<a href="https://badge.fury.io/rb/opal"><img src="https://img.shields.io/gem/v/opal.svg?style=flat" alt="Gem Version" title="" /></a>
|
25
|
-
<a href="https://github.com/opal/opal/actions?query=workflow%3Abuild"><img
|
25
|
+
<a href="https://github.com/opal/opal/actions?query=workflow%3Abuild"><img src="https://github.com/opal/opal/workflows/build/badge.svg" alt="Build Status" /></a>
|
26
26
|
<a href="https://codeclimate.com/github/opal/opal"><img src="https://img.shields.io/codeclimate/maintainability-percentage/opal/opal.svg" alt="Code Climate" title="" /></a>
|
27
27
|
<a href="https://coveralls.io/github/opal/opal?branch=master"><img src="https://coveralls.io/repos/opal/opal/badge.svg?branch=master&service=github" alt="Coverage Status" title="" /></a>
|
28
28
|
|
29
29
|
<br>
|
30
30
|
<strong>Sponsors:</strong>
|
31
|
-
<br/><a href="https://nebulab.it?utm_source=github&utm_medium=badge"><img src="https://img.shields.io/static/v1?label=Nebulab&message=Open+Source+Fridays&color=%235dbefd&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMQSURBVHgBrZZNTxNRFIbfczsgIMQiLBCRFDaGhUr9A9iiIa5EEneIwE/AlRsNv8KlIKwF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z8hbUjaz0Fr8ZanXhX0pPOw5SrV8wNGjNscMrTKpXKaj05f9twVYHnMZGPHEuwTwEBNi+3NGiNt6GRcsfEIAfhp2cAV3cQLtXoOz7q8+ZJRLx3kmxn4dy7aas1SrfiBpKraV/9A+PSJLDAXLUvAAAAAElFTkSuQmCC" alt="Nebulab: Open Source Fridays" /></a>
|
32
32
|
</p>
|
33
33
|
|
34
34
|
## Usage
|
@@ -216,21 +216,16 @@ then we support Opera 12.1x, 19.x and 20.x but not Opera 15.x through 18.x.
|
|
216
216
|
|
217
217
|
This project exists thanks to all the people who contribute. [![contributors](https://opencollective.com/opal/contributors.svg?width=890&button=false")](https://github.com/opal/opal/graphs/contributors)
|
218
218
|
|
219
|
+
## Versioning
|
220
|
+
|
221
|
+
Opal will broadly follow semver as a version policy, trying to bump the major version when introducing breaking changes.
|
222
|
+
Being a language implementation we're also aware that there's a fine line between what can be considered breaking and what is expected to be "safe" or just "additive". Moving forward we'll attempt to better clarify what interfaces are meant to be public and what should be considered private.
|
219
223
|
|
220
224
|
## Backers
|
221
225
|
|
222
226
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/opal#backer)]
|
223
227
|
|
224
|
-
<a href="https://opencollective.com/opal#backers" target="_blank"><img src="https://opencollective.com/opal/backers.svg?width=890"
|
225
|
-
|
226
|
-
|
227
|
-
## Sponsors
|
228
|
-
|
229
|
-
### Donations
|
230
|
-
|
231
|
-
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/opal#sponsor)]
|
232
|
-
|
233
|
-
<a href="https://opencollective.com/opal/sponsor/0/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/0/avatar.svg"></a>
|
228
|
+
<a href="https://opencollective.com/opal#backers" target="_blank"><img src="https://opencollective.com/opal/backers.svg?width=890" alt="Become a Backer Button" /></a>
|
234
229
|
<a href="https://opencollective.com/opal/sponsor/1/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/1/avatar.svg"></a>
|
235
230
|
<a href="https://opencollective.com/opal/sponsor/2/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/2/avatar.svg"></a>
|
236
231
|
<a href="https://opencollective.com/opal/sponsor/3/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/3/avatar.svg"></a>
|
@@ -241,16 +236,25 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
241
236
|
<a href="https://opencollective.com/opal/sponsor/8/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/8/avatar.svg"></a>
|
242
237
|
<a href="https://opencollective.com/opal/sponsor/9/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/9/avatar.svg"></a>
|
243
238
|
|
239
|
+
|
240
|
+
## Sponsors
|
241
|
+
|
242
|
+
### Donations
|
243
|
+
|
244
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/opal#sponsor)]
|
245
|
+
|
246
|
+
<a href="https://opencollective.com/opal/sponsor/0/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/0/avatar.svg" alt="Become a Sponsor Button"></a>
|
247
|
+
|
244
248
|
### Sponsored Contributions
|
245
249
|
|
246
|
-
<a href="https://nebulab.it/?utm_source=github&utm_medium=sponsors" target="_blank"><img src="https://nebulab.
|
250
|
+
<a href="https://nebulab.it/?utm_source=github&utm_medium=sponsors" target="_blank"><img src="https://nebulab.com/assets/img/logo-nebulab_black.svg" alt="Nebulab Logo"></a>
|
247
251
|
|
248
252
|
|
249
253
|
## License
|
250
254
|
|
251
255
|
(The MIT License)
|
252
256
|
|
253
|
-
Copyright (C) 2013-
|
257
|
+
Copyright (C) 2013-2021 by Adam Beynon and the Opal contributors
|
254
258
|
|
255
259
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
256
260
|
of this software and associated documentation files (the "Software"), to deal
|
data/UNRELEASED.md
CHANGED
@@ -1,109 +1,46 @@
|
|
1
1
|
### Added
|
2
2
|
|
3
|
-
-
|
4
|
-
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
- `
|
8
|
-
-
|
9
|
-
-
|
10
|
-
- `
|
11
|
-
-
|
12
|
-
- `
|
13
|
-
- `Opal.$$$` is now a shortcut for `Opal.const_get_qualified`
|
14
|
-
- Source-map support for Node.js in the default runner (#2045)
|
15
|
-
- SecureRandom#hex(n) (#2050)
|
16
|
-
- Added a generic implementation of Kernel#caller and #warn(uplevel:) that works with sourcemaps in Node.js and Chrome (#2065)
|
17
|
-
- Added support for numblocks `-> { _1 + _2 }.call(3, 4) # => 7` (#2149)
|
18
|
-
- Support `<internal:…>` and `<js:…>` in stacktraces, like MRI we now distinguish internal lines from lib/app lines (#2154)
|
19
|
-
- `Array#difference`, `Array#intersection`, `Array#union` as aliases respectively to `Array#{-,&,|}` (#2151)
|
20
|
-
- Aliases `filter{,!}` to `select{,!}` throughout the corelib classes (#2151)
|
21
|
-
- `Enumerable#filter_map`, `Enumerable#tally` (#2151)
|
22
|
-
- Alias `Kernel#then` for `Kernel#yield_self` (#2151)
|
23
|
-
- Method chaining: `{Proc,Method}#{<<,>>}` (#2151)
|
24
|
-
- Added Integer#to_d (#2006)
|
25
|
-
- Added a compiler option `use_strict` which can also be set by the `use_strict` magic comment (#1959)
|
26
|
-
- Add `--rbrequire (-q)` option to `opal` command line executable (#2120)
|
3
|
+
- Support for multiple arguments in Hash#{merge, merge!, update} (#2187)
|
4
|
+
- Support for Ruby 3.0 forward arguments: `def a(...) puts(...) end` (#2153)
|
5
|
+
- Support for beginless and endless ranges: `(1..)`, `(..1)` (#2150)
|
6
|
+
- Preliminary support for `**nil` argument - see #2240 to note limitations (#2152)
|
7
|
+
- Support for `Random::Formatters` which add methods `#{hex,base64,urlsafe_base64,uuid,random_float,random_number,alphanumeric}` to `Random` and `SecureRandom` (#2218)
|
8
|
+
- Basic support for ObjectSpace finalizers and ObjectSpace::WeakMap (#2247)
|
9
|
+
- A more robust support for encodings (especially binary strings) (#2235)
|
10
|
+
- Support for `"\x80"` syntax in String literals (#2235)
|
11
|
+
- Added `String#+@`, `String#-@` (#2235)
|
12
|
+
- Support for `begin <CODE> end while <CONDITION>` (#2255)
|
27
13
|
|
28
14
|
### Fixed
|
29
15
|
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
- Set#reject! (#1987)
|
46
|
-
- String#unicode_normalize (#2175)
|
47
|
-
- Module#alias_method (#1983)
|
48
|
-
- Enumerable#minmax_by (#1981)
|
49
|
-
- Enumerator#each_with_index (#1990)
|
50
|
-
- Range#== (#1992)
|
51
|
-
- Range#each (#1991)
|
52
|
-
- Enumerable#zip (#1986)
|
53
|
-
- String#getbyte (#2141)
|
54
|
-
- Struct#dup not copying `$$data` (#1995)
|
55
|
-
- Fixed usage of semicolon in single-line backticks (#2004)
|
56
|
-
- Module#attr with multiple arguments (#2003)
|
57
|
-
- `PathReader` used to try to read missing files instead of respecting the `missing_require_severity` configuration value (#2044)
|
58
|
-
- Removed some unused variables from the runtime (#2052)
|
59
|
-
- Fixed a typo in the runtime (#2054)
|
60
|
-
- Fix Regexp interpolation, previously interpolating with other regexps was broken (#2062)
|
61
|
-
- Set match on StringScanner#skip and StringScanner#scan_until (#2061)
|
62
|
-
- Fix ruby 2.7 warnings (#2071)
|
63
|
-
- Improve the --help descriptions (#2146)
|
64
|
-
- Remove BasicObject#class (#2166)
|
65
|
-
- Time#strftime %j leading zeros (#2161)
|
66
|
-
- Fix `call { true or next }` producing invalid code (#2160)
|
67
|
-
- `define_method` can now be called on the main object (#2029)
|
68
|
-
- Fix nested for-loops (#2033)
|
69
|
-
- Fix Number#round for Integers (#2030)
|
70
|
-
- Fix parsing Unicode characters from Opal (#2073)
|
71
|
-
- Integer#===: improve Integer recognition (#2089)
|
72
|
-
- Regexp: ensure ignoreCase is never undefined (#2098)
|
73
|
-
- Hash#delete: ensure String keys are converted to values (#2106)
|
74
|
-
- Array#shift: improve performance on v8 >7.1 (#2115)
|
75
|
-
- Array#pop(1): improve performance (#2130)
|
76
|
-
- Object#pretty_inspect (#2139)
|
77
|
-
- Fix conversion from UTF-8 to bytes (#2138)
|
78
|
-
- Restore compatibility with Chrome 38, used by Cordova and many mobile browsers (#2109)
|
16
|
+
- Encoding lookup was working only with uppercase names, not giving any errors for wrong ones (#2181, #2183, #2190)
|
17
|
+
- Fix `Number#to_i` with huge number (#2191)
|
18
|
+
- Add regexp support to `String#start_with` (#2198)
|
19
|
+
- `String#bytes` now works in strict mode (#2194)
|
20
|
+
- Fix nested module inclusion (#2053)
|
21
|
+
- SecureRandom is now cryptographically secure on most platforms (#2218, #2170)
|
22
|
+
- Fix performance regression for `Array#unshift` on v8 > 7.1 (#2116)
|
23
|
+
- 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)
|
24
|
+
- Number#step is moved to Numeric (#2100)
|
25
|
+
- Fix class Class < superclass for invalid superclasses (#2123)
|
26
|
+
- Fix `String#unpack("U*")` on binary strings with latin1 high characters, fix performance regression on that call (#2235, #2189, #2129, #2099, #2094, #2000, #2128)
|
27
|
+
- Fix `String#to_json` output on some edge cases (#2235)
|
28
|
+
- Rework class variables to support inheritance correctly (#2251)
|
29
|
+
- ISO-8859-1 and US-ASCII encodings are now separated as in MRI (#2235)
|
30
|
+
- `String#b` no longer modifies object strings in-place (#2235)
|
79
31
|
|
80
32
|
### Changed
|
81
33
|
|
82
|
-
-
|
83
|
-
-
|
84
|
-
- "opal
|
85
|
-
-
|
86
|
-
- `
|
87
|
-
- Moved REPL implementation from bin/ to its own lib/ file as `opal/repl.rb` (#2048)
|
88
|
-
- `Encoding.default_external` is now initialized with `__ENCODING__` (#2072)
|
89
|
-
- Keep the MersenneTwister implementation private (#2108)
|
90
|
-
- Change parser to 3.0 (#2148)
|
91
|
-
- Fix forwarding a rescued error to a global var: `rescue => $gvar` (#2154)
|
92
|
-
- Now using Parser v3.0 and targeting Ruby 3.0 (#2156)
|
93
|
-
- `Comparable#clamp` to support a Range argument (#2151)
|
94
|
-
- `#to_h` method to support a block (shortform for `.map(&block).to_h`) (#2151)
|
95
|
-
- BigDecimal is now a subclass of Numeric (#2006)
|
96
|
-
- PP to be rebased on upstream Ruby version (#2083)
|
97
|
-
- String to report UTF-8 encoding by default, as MRI does (#2117)
|
98
|
-
- Don't output "Failed to load WithCLexer, using pure Ruby lexer" warning unless in $DEBUG mode (#2174)
|
34
|
+
- `String#unpack`, `Array#pack`, `String#chars`, `String#length`, `Number#chr`, and (only partially) `String#+` are now encoding aware (#2235)
|
35
|
+
- `String#inspect` now uses `\x` for binary stirngs (#2235)
|
36
|
+
- `if RUBY_ENGINE == "opal"` and friends are now outputing less JS code (#2159, #1965)
|
37
|
+
- `Array`: `to_a`, `slice`/`[]`, `uniq`, `*`, `difference`/`-`, `intersection`/`&`, `union`/`|`, flatten now return Array, not a subclass, as Ruby 3.0 does (#2237)
|
38
|
+
- `Array`: `difference`, `intersection`, `union` now accept multiple arguments (#2237)
|
99
39
|
|
100
40
|
### Deprecated
|
101
41
|
|
102
|
-
-
|
103
|
-
supported by the default Node.js runner or by requiring https://github.com/evanw/node-source-map-support
|
104
|
-
before loading code compiled by Opal (#2045)
|
42
|
+
- Stopped testing Opal on Ruby 2.5 since it reached EOL.
|
105
43
|
|
106
44
|
### Removed
|
107
45
|
|
108
|
-
- Removed
|
109
|
-
- Removed the deprecated `tainting` compiler config option (#2072)
|
46
|
+
- Removed support for the outdated `c_lexer`, it was optional and didn't work for the last few releases of parser (#2235)
|