opal 0.11.0 → 0.11.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +1 -0
- data/.travis.yml +38 -22
- data/CHANGELOG.md +50 -30
- data/Gemfile +13 -5
- data/README.md +4 -4
- data/appveyor.yml +7 -1
- data/benchmark/benchmarks +8 -8
- data/benchmark/run.rb +10 -3
- data/docs/compiled_ruby.md +1 -1
- data/lib/opal/builder.rb +12 -7
- data/lib/opal/cli.rb +9 -2
- data/lib/opal/cli_options.rb +8 -0
- data/lib/opal/cli_runners/applescript.rb +2 -1
- data/lib/opal/cli_runners/server.rb +44 -17
- data/lib/opal/config.rb +19 -2
- data/lib/opal/nodes/rescue.rb +1 -1
- data/lib/opal/rewriters/base.rb +48 -2
- data/lib/opal/version.rb +1 -1
- data/opal/README.md +1 -1
- data/opal/corelib/array.rb +1 -1
- data/opal/corelib/basic_object.rb +0 -2
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/runtime.js +1 -1
- data/tasks/benchmarking.rake +32 -16
- data/tasks/testing/opal_rspec_smoketest.Gemfile +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9e4c215f37f6b92b776785029ac9f95cffc505ef4170af6434687792cc5066ce
|
4
|
+
data.tar.gz: 0264165c74f9d1288b83ce82faad6e9fbb6b7311f7be0e3afc962f6c5f80ae48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eff37207eb72182df2ed414709c357297bd0a31dc3d7086c84aaffba078b8b5cfb78af25a72f4418e4a9b518eb5ebcdf38d5a1146cbdd7f03dfa14ad8bb37a24
|
7
|
+
data.tar.gz: 52b26857496d677b7e01967ba51e8493b0499f8bb090f753fdbb3c89d42aa12749d5fd2d3eeff98b2c220fa5ab4c7805c746d42c0af10b99ef3c15a007b0686f
|
data/.codeclimate.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,68 +1,80 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
|
-
sudo:
|
3
|
+
sudo: required
|
4
4
|
|
5
5
|
dist: trusty
|
6
|
+
|
6
7
|
addons:
|
7
8
|
chrome: stable
|
8
9
|
|
10
|
+
branches:
|
11
|
+
only:
|
12
|
+
- master
|
13
|
+
- /^.*-stable$/
|
14
|
+
- /^.*ci-check$/
|
15
|
+
|
9
16
|
cache:
|
10
17
|
bundler: true
|
11
18
|
directories:
|
12
19
|
- /home/travis/.nvm/
|
13
20
|
- smoke_test_opal_rspec
|
14
21
|
|
22
|
+
|
15
23
|
matrix:
|
16
24
|
fast_finish: true
|
17
25
|
|
18
26
|
include:
|
19
|
-
- rvm: 2.
|
20
|
-
env: RUN=mspec_opal_chrome
|
27
|
+
- rvm: 2.5.1
|
28
|
+
env: RUN=mspec_opal_chrome REINSTALL_BUNDLER=true
|
21
29
|
|
22
|
-
- rvm: 2.
|
23
|
-
env: RUN=mspec_ruby_chrome
|
30
|
+
- rvm: 2.5.1
|
31
|
+
env: RUN=mspec_ruby_chrome REINSTALL_BUNDLER=true
|
24
32
|
|
25
|
-
# - rvm: 2.
|
33
|
+
# - rvm: 2.5.1
|
26
34
|
# env:
|
27
35
|
# - RUN=browser_test
|
28
36
|
# - SAUCE_USERNAME=elia
|
29
37
|
# # SAUCE_ACCESS_KEY:
|
30
38
|
# - secure: GT13SjzU8vmqKIyY2LAXje+ndqevTsX/w71JkZHRLTrDUl0qcIod7xsfahbzGt2gOZPYZUkKiVaPoUenhc/YeJ2jTJVHeHY9UEl2II+3tOtuvp2jLadA//aBbsB6/09d7lIZMzpa93TL2R/SncPxugYW9v2o8o8Lwd2iIzowT/g=
|
31
39
|
|
32
|
-
- rvm: 2.
|
33
|
-
env: RUN=jshint
|
40
|
+
- rvm: 2.5.1
|
41
|
+
env: RUN=jshint REINSTALL_BUNDLER=true
|
34
42
|
|
35
|
-
- rvm: 2.
|
36
|
-
env: RUN=mspec_opal_nodejs
|
43
|
+
- rvm: 2.5.1
|
44
|
+
env: RUN=mspec_opal_nodejs REINSTALL_BUNDLER=true
|
37
45
|
|
38
|
-
- rvm: 2.
|
39
|
-
env: RUN=mspec_ruby_nodejs TZ="/usr/share/zoneinfo/Pacific/Fiji"
|
46
|
+
- rvm: 2.5.1
|
47
|
+
env: RUN=mspec_ruby_nodejs REINSTALL_BUNDLER=true TZ="/usr/share/zoneinfo/Pacific/Fiji"
|
40
48
|
|
41
|
-
- rvm: 2.
|
42
|
-
env: RUN=minitest
|
49
|
+
- rvm: 2.5.1
|
50
|
+
env: RUN=minitest REINSTALL_BUNDLER=true
|
43
51
|
|
44
|
-
- rvm: 2.
|
45
|
-
env: RUN=rspec RACK_VERSION='~> 2.0.0' CHECK_COVERAGE=true
|
52
|
+
- rvm: 2.5.1
|
53
|
+
env: RUN=rspec RACK_VERSION='~> 2.0.0' CHECK_COVERAGE=true REINSTALL_BUNDLER=true
|
46
54
|
|
47
|
-
- rvm: 2.
|
48
|
-
env: RUN=smoke_test
|
55
|
+
- rvm: 2.5.1
|
56
|
+
env: RUN=smoke_test REINSTALL_BUNDLER=true
|
49
57
|
|
50
58
|
- rvm: ruby-head
|
51
|
-
env: RUN=rspec
|
59
|
+
env: RUN=rspec REINSTALL_BUNDLER=true
|
60
|
+
|
61
|
+
- rvm: 2.4.4
|
62
|
+
env: RUN=rspec RACK_VERSION='~> 2.0.0' REINSTALL_BUNDLER=true
|
52
63
|
|
53
|
-
- rvm: 2.3.
|
64
|
+
- rvm: 2.3.7
|
54
65
|
env: RUN=rspec
|
55
66
|
|
56
|
-
- rvm: 2.2.
|
67
|
+
- rvm: 2.2.10
|
57
68
|
env: RUN=rspec TILT_VERSION=2.0.1 SPROCKETS_VERSION='~> 3.7'
|
58
69
|
|
59
70
|
- rvm: 2.1.10
|
60
71
|
env: RUN=rspec RACK_VERSION='< 2.0'
|
61
72
|
|
62
73
|
- rvm: 2.0.0
|
74
|
+
nvm: "0.10"
|
63
75
|
env: RUN="rspec mspec_opal_nodejs" RACK_VERSION='< 2.0'
|
64
76
|
|
65
|
-
- rvm: jruby-9.
|
77
|
+
- rvm: jruby-9.2.0.0
|
66
78
|
env: RUN=rspec
|
67
79
|
|
68
80
|
- rvm: jruby-head
|
@@ -80,11 +92,15 @@ before_install:
|
|
80
92
|
- git submodule update --init
|
81
93
|
- npm install -g jshint
|
82
94
|
- npm install -g uglify-js
|
95
|
+
- test $REINSTALL_BUNDLER && gem install bundler || true
|
83
96
|
- type bundle || gem install bundler
|
84
97
|
- bundle config without doc
|
85
98
|
- which google-chrome-stable
|
86
99
|
- google-chrome-stable --version
|
87
100
|
- export RUBYOPT=-w
|
101
|
+
# Wokraround from https://github.com/travis-ci/travis-ci/issues/9024#issuecomment-356282802
|
102
|
+
- sudo chown root /opt/google/chrome/chrome-sandbox
|
103
|
+
- sudo chmod 4755 /opt/google/chrome/chrome-sandbox
|
88
104
|
|
89
105
|
script:
|
90
106
|
- "bundle exec rake $RUN"
|
data/CHANGELOG.md
CHANGED
@@ -21,7 +21,20 @@ Whitespace conventions:
|
|
21
21
|
|
22
22
|
|
23
23
|
|
24
|
-
## [0.11.0
|
24
|
+
## [0.11.1](https://github.com/opal/opal/compare/v0.11.0...v0.11.1.pre) - Unreleased
|
25
|
+
|
26
|
+
|
27
|
+
### Added
|
28
|
+
|
29
|
+
- Added support for a static folder in the "server" CLI runner via the `OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER` env var
|
30
|
+
- 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 depreted)
|
31
|
+
- 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.
|
32
|
+
- At run-time `LoadError` wasn't being raised even with `Opal.config.missing_require_severity;` set to `'error'`.
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
## [0.11.0] - 2017-12-08
|
25
38
|
|
26
39
|
|
27
40
|
### Added
|
@@ -89,6 +102,11 @@ Whitespace conventions:
|
|
89
102
|
- 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).
|
90
103
|
|
91
104
|
|
105
|
+
### Changed
|
106
|
+
|
107
|
+
- Strip Regexp flags that are unsupported by browsers (backport), previously they were ignored, lately most of them now raise an error for unknown flags.
|
108
|
+
|
109
|
+
|
92
110
|
### Fixed
|
93
111
|
|
94
112
|
- Newly compliant with the Ruby Spec Suite:
|
@@ -120,11 +138,12 @@ Whitespace conventions:
|
|
120
138
|
- `Module#append_features` now detects cyclic includes
|
121
139
|
- `Process.clock_gettime(Process::CLOCK_MONOTONIC)` will now return true monotonic values or raise `Errno::EINVAL` if no monotonic clock is available
|
122
140
|
- Opal::Builder no longer always raises an error when a dependency isn't found and instead respects `dynamic_require_severity` value
|
141
|
+
- Fixed a constant reference to `Sprockets::FileNotFound` that previously pointed to `Opal::Sprockets` instead of `::Sprockets`.
|
123
142
|
|
124
143
|
|
125
144
|
|
126
145
|
|
127
|
-
## [0.10.5] - 2017-06-21
|
146
|
+
## [0.10.5](https://github.com/opal/opal/compare/v0.10.4...v0.10.5) - 2017-06-21
|
128
147
|
|
129
148
|
|
130
149
|
### Fixed
|
@@ -134,7 +153,7 @@ Whitespace conventions:
|
|
134
153
|
|
135
154
|
|
136
155
|
|
137
|
-
## [0.10.4] - 2017-05-07
|
156
|
+
## [0.10.4](https://github.com/opal/opal/compare/v0.10.3...v0.10.4) - 2017-05-07
|
138
157
|
|
139
158
|
|
140
159
|
### Changed
|
@@ -145,7 +164,7 @@ Whitespace conventions:
|
|
145
164
|
|
146
165
|
|
147
166
|
|
148
|
-
## [0.10.3] - 2016-10-31
|
167
|
+
## [0.10.3](https://github.com/opal/opal/compare/v0.10.2...v0.10.3) - 2016-10-31
|
149
168
|
|
150
169
|
|
151
170
|
### Fixed
|
@@ -158,7 +177,7 @@ Whitespace conventions:
|
|
158
177
|
|
159
178
|
|
160
179
|
|
161
|
-
## [0.10.2] - 2016-09-09
|
180
|
+
## [0.10.2](https://github.com/opal/opal/compare/v0.10.1...v0.10.2) - 2016-09-09
|
162
181
|
|
163
182
|
|
164
183
|
### Changed
|
@@ -168,7 +187,7 @@ Whitespace conventions:
|
|
168
187
|
|
169
188
|
|
170
189
|
|
171
|
-
## [0.10.1] - 2016-07-06
|
190
|
+
## [0.10.1](https://github.com/opal/opal/compare/v0.10.0...v0.10.1) - 2016-07-06
|
172
191
|
|
173
192
|
|
174
193
|
### Fixed
|
@@ -178,7 +197,7 @@ Whitespace conventions:
|
|
178
197
|
|
179
198
|
|
180
199
|
|
181
|
-
## [0.10.0] - 2016-07-04
|
200
|
+
## [0.10.0](https://github.com/opal/opal/compare/v0.9.4...v0.10.0) - 2016-07-04
|
182
201
|
|
183
202
|
|
184
203
|
### Added
|
@@ -291,7 +310,7 @@ Whitespace conventions:
|
|
291
310
|
|
292
311
|
|
293
312
|
|
294
|
-
## [0.9.4] - 2016-06-21
|
313
|
+
## [0.9.4](https://github.com/opal/opal/compare/v0.9.3...v0.9.4) - 2016-06-21
|
295
314
|
|
296
315
|
|
297
316
|
### Fixed
|
@@ -303,7 +322,7 @@ Whitespace conventions:
|
|
303
322
|
|
304
323
|
|
305
324
|
|
306
|
-
## [0.9.3] - 2016-06-06
|
325
|
+
## [0.9.3](https://github.com/opal/opal/compare/v0.9.2...v0.9.3) - 2016-06-06
|
307
326
|
|
308
327
|
|
309
328
|
### Fixed
|
@@ -313,7 +332,7 @@ Whitespace conventions:
|
|
313
332
|
|
314
333
|
|
315
334
|
|
316
|
-
## [0.9.2] - 2016-01-10
|
335
|
+
## [0.9.2](https://github.com/opal/opal/compare/v0.9.1...v0.9.2) - 2016-01-10
|
317
336
|
|
318
337
|
|
319
338
|
### Fixed
|
@@ -323,7 +342,7 @@ Whitespace conventions:
|
|
323
342
|
|
324
343
|
|
325
344
|
|
326
|
-
## [0.9.1] - 2016-01-09
|
345
|
+
## [0.9.1](https://github.com/opal/opal/compare/v0.9.0...v0.9.1) - 2016-01-09
|
327
346
|
|
328
347
|
|
329
348
|
### Fixed
|
@@ -335,7 +354,7 @@ Whitespace conventions:
|
|
335
354
|
|
336
355
|
|
337
356
|
|
338
|
-
## [0.9.0] - 2015-12-20
|
357
|
+
## [0.9.0](https://github.com/opal/opal/compare/v0.8.1...v0.9.0) - 2015-12-20
|
339
358
|
|
340
359
|
|
341
360
|
### Added
|
@@ -407,7 +426,7 @@ Whitespace conventions:
|
|
407
426
|
|
408
427
|
|
409
428
|
|
410
|
-
## [0.8.1] - 2015-10-12
|
429
|
+
## [0.8.1](https://github.com/opal/opal/compare/v0.8.0...v0.8.1) - 2015-10-12
|
411
430
|
|
412
431
|
|
413
432
|
### Removed
|
@@ -424,7 +443,7 @@ Whitespace conventions:
|
|
424
443
|
|
425
444
|
|
426
445
|
|
427
|
-
## [0.8.0] - 2015-07-16
|
446
|
+
## [0.8.0](https://github.com/opal/opal/compare/v0.7.2...v0.8.0) - 2015-07-16
|
428
447
|
|
429
448
|
|
430
449
|
### Added
|
@@ -505,13 +524,13 @@ Whitespace conventions:
|
|
505
524
|
|
506
525
|
|
507
526
|
|
508
|
-
## [0.7.2] - 2015-04-23
|
527
|
+
## [0.7.2](https://github.com/opal/opal/compare/v0.7.1...v0.7.2) - 2015-04-23
|
509
528
|
|
510
529
|
- Remove Sprockets 3.0 support (focus moved to upcoming 0.8)
|
511
530
|
- Fix version number consistency.
|
512
531
|
|
513
532
|
|
514
|
-
## [0.7.1] - 2015-02-14
|
533
|
+
## [0.7.1](https://github.com/opal/opal/compare/v0.7.0...v0.7.1) - 2015-02-14
|
515
534
|
|
516
535
|
- CLI options `-d` and `-v` now set respectively `$DEBUG` and `$VERBOSE`
|
517
536
|
- Fixed a bug that would make the `-v` CLI option wait for STDIN input
|
@@ -519,7 +538,7 @@ Whitespace conventions:
|
|
519
538
|
- Now the CLI implicitly calls `Kernel#exit` at the end of the script, thus making `at_exit` blocks be respected.
|
520
539
|
|
521
540
|
|
522
|
-
## [0.7.0] - 2015-02-01
|
541
|
+
## [0.7.0](https://github.com/opal/opal/compare/v0.6.2...v0.7.0) - 2015-02-01
|
523
542
|
|
524
543
|
- Stop keyword-arg variable names leaking to global javascript scope
|
525
544
|
|
@@ -603,7 +622,7 @@ Whitespace conventions:
|
|
603
622
|
- Fix `Enumerator#with_index`, `Numeric#round`.
|
604
623
|
|
605
624
|
|
606
|
-
## [0.6.2] - 2014-04-25
|
625
|
+
## [0.6.2](https://github.com/opal/opal/compare/v0.6.1...v0.6.2) - 2014-04-25
|
607
626
|
|
608
627
|
- Added Range#size
|
609
628
|
|
@@ -614,7 +633,7 @@ Whitespace conventions:
|
|
614
633
|
- (Internal) improved the mspec runner
|
615
634
|
|
616
635
|
|
617
|
-
## [0.6.1] - 2014-04-15
|
636
|
+
## [0.6.1](https://github.com/opal/opal/compare/v0.6.0...v0.6.1) - 2014-04-15
|
618
637
|
|
619
638
|
- Updated RubySpec to master and added `rubysl-*` specs. Thanks to Mike Owens (@mieko)
|
620
639
|
|
@@ -639,7 +658,7 @@ Whitespace conventions:
|
|
639
658
|
parse as a key name.
|
640
659
|
|
641
660
|
|
642
|
-
## [0.6.0] - 2014-03-05
|
661
|
+
## [0.6.0](https://github.com/opal/opal/compare/v0.5.5...v0.6.0) - 2014-03-05
|
643
662
|
|
644
663
|
- Fix parsing of escapes in single-strings ('foo\n'). Only ' and \
|
645
664
|
characters now get escaped in single quoted strings. Also, more escape
|
@@ -761,7 +780,7 @@ Whitespace conventions:
|
|
761
780
|
- Add `Regexp.quote` as an alias of `escape`.
|
762
781
|
|
763
782
|
|
764
|
-
## [0.5.5] - 2013-11-25
|
783
|
+
## [0.5.5](https://github.com/opal/opal/compare/v0.5.4...v0.5.5) - 2013-11-25
|
765
784
|
|
766
785
|
- Fix regression: add `%i[foo bar]` style words back to lexer
|
767
786
|
|
@@ -769,13 +788,13 @@ Whitespace conventions:
|
|
769
788
|
`core/` clashing with user files.
|
770
789
|
|
771
790
|
|
772
|
-
## [0.5.4] - 2013-11-20
|
791
|
+
## [0.5.4](https://github.com/opal/opal/compare/v0.5.3...v0.5.4) - 2013-11-20
|
773
792
|
|
774
793
|
- Reverted `RUBY_VERSION` to `1.9.3`. Opal `0.6.0` will be the first release
|
775
794
|
for `2.0.0`.
|
776
795
|
|
777
796
|
|
778
|
-
## [0.5.3] - 2013-11-12
|
797
|
+
## [0.5.3](https://github.com/opal/opal/compare/v0.5.2...v0.5.3) - 2013-11-12
|
779
798
|
|
780
799
|
- Opal now targets ruby 2.0.0
|
781
800
|
|
@@ -799,12 +818,12 @@ Whitespace conventions:
|
|
799
818
|
- Cleanup parser/lexer to use `t` and `k` prefixes for all tokens
|
800
819
|
|
801
820
|
|
802
|
-
## [0.5.2] - 2013-11-11
|
821
|
+
## [0.5.2](https://github.com/opal/opal/compare/v0.5.1...v0.5.2) - 2013-11-11
|
803
822
|
|
804
823
|
- Include native into corelib for 0.5.x
|
805
824
|
|
806
825
|
|
807
|
-
## [0.5.1] - 2013-11-10
|
826
|
+
## [0.5.1](https://github.com/opal/opal/compare/v0.5.0...v0.5.1) - 2013-11-10
|
808
827
|
|
809
828
|
- Move all corelib under `core/` directory to prevent filename clashes with
|
810
829
|
`require`
|
@@ -816,12 +835,12 @@ Whitespace conventions:
|
|
816
835
|
- Cleanup and fix various `Enumerable` methods
|
817
836
|
|
818
837
|
|
819
|
-
## [0.5.0] - 2013-11-03
|
838
|
+
## [0.5.0](https://github.com/opal/opal/compare/v0.4.2...v0.5.0) - 2013-11-03
|
820
839
|
|
821
840
|
- WIP: https://gist.github.com/elia/7747460
|
822
841
|
|
823
842
|
|
824
|
-
## [0.4.2] - 2013-07-03
|
843
|
+
## [0.4.2](https://github.com/opal/opal/compare/v0.4.1...v0.4.2) - 2013-07-03
|
825
844
|
|
826
845
|
- Added `Kernel#rand`. (fntzr)
|
827
846
|
|
@@ -835,13 +854,13 @@ Whitespace conventions:
|
|
835
854
|
format: `(((tmp = lhs) !== false || !==nil) ? tmp : rhs)`.
|
836
855
|
|
837
856
|
|
838
|
-
## [0.4.1] - 2013-06-16
|
857
|
+
## [0.4.1](https://github.com/opal/opal/compare/v0.4.0...v0.4.1) - 2013-06-16
|
839
858
|
|
840
859
|
- Move sprockets logic out to external opal-sprockets gem. That now
|
841
860
|
handles the compiling and loading of opal files in sprockets.
|
842
861
|
|
843
862
|
|
844
|
-
## [0.4.0] - 2013-06-15
|
863
|
+
## [0.4.0](https://github.com/opal/opal/compare/v0.3.44...v0.4.0) - 2013-06-15
|
845
864
|
|
846
865
|
- Added fragments to parser. All parser methods now generate one or
|
847
866
|
more Fragments which store the original sexp. This allows us to
|
@@ -1006,7 +1025,8 @@ Whitespace conventions:
|
|
1006
1025
|
|
1007
1026
|
|
1008
1027
|
|
1009
|
-
[0.11.
|
1028
|
+
[0.11.1]: https://github.com/opal/opal/compare/v0.11.0...HEAD
|
1029
|
+
[0.11.0]: https://github.com/opal/opal/compare/v0.10.5...0.11.0
|
1010
1030
|
[0.10.5]: https://github.com/opal/opal/compare/v0.10.4...v0.10.5
|
1011
1031
|
[0.10.4]: https://github.com/opal/opal/compare/v0.10.3...v0.10.4
|
1012
1032
|
[0.10.3]: https://github.com/opal/opal/compare/v0.10.2...v0.10.3
|
data/Gemfile
CHANGED
@@ -1,20 +1,28 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
v = -> version { Gem::Version.new(version) if version }
|
5
|
+
|
6
|
+
ruby_version = v[RUBY_VERSION]
|
7
|
+
|
8
|
+
tilt_version = ENV['TILT_VERSION']
|
9
|
+
rack_version = ENV['RACK_VERSION']
|
6
10
|
sprockets_version = ENV['SPROCKETS_VERSION']
|
7
11
|
|
8
12
|
# Stick with older racc until
|
9
13
|
# https://github.com/tenderlove/racc/issues/22
|
10
14
|
# is solved.
|
11
15
|
gem 'racc', '< 1.4.10', platform: :jruby
|
12
|
-
gem 'json', '< 1.8.1', platform: :ruby if
|
16
|
+
gem 'json', '< 1.8.1', platform: :ruby if ruby_version < v['2.2']
|
17
|
+
gem 'rack-test', '< 1.0' if ruby_version < v['2.2.2']
|
13
18
|
gem 'rubysl', platform: :rbx
|
14
19
|
gem 'coveralls', platform: :mri
|
20
|
+
|
15
21
|
gem 'puma' # Some browsers have problems with WEBrick
|
16
|
-
|
17
|
-
gem '
|
22
|
+
|
23
|
+
gem 'rack', rack_version if rack_version
|
24
|
+
gem 'tilt', tilt_version if tilt_version
|
25
|
+
|
18
26
|
gem 'sprockets', sprockets_version if sprockets_version
|
19
27
|
gem 'mspec', path: 'spec/mspec'
|
20
28
|
|
data/README.md
CHANGED
@@ -13,13 +13,13 @@ implementation of the Ruby corelib.
|
|
13
13
|
Opal is [hosted on GitHub](http://github.com/opal/opal). Chat is available on *Gitter* at [opal/opal](https://gitter.im/opal/opal) (also available as IRC at `irc.gitter.im`) and the Freenode IRC channel at [#opal](http://webchat.freenode.net/?channels=opal).
|
14
14
|
Ask questions on [stackoverflow (tag #opalrb)](http://stackoverflow.com/questions/ask?tags=opalrb). Get the [Opalist newsletter](http://opalist.co) for updates and community news.
|
15
15
|
|
16
|
-
[![Inline docs](http://inch-ci.org/github/opal/opal.svg?branch=master&style=flat)](http://opalrb.
|
16
|
+
[![Inline docs](http://inch-ci.org/github/opal/opal.svg?branch=master&style=flat)](http://opalrb.com/docs)
|
17
17
|
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/opal/opal?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
18
18
|
[![Stack Overflow](http://img.shields.io/badge/stackoverflow-%23opalrb-orange.svg?style=flat)](http://stackoverflow.com/questions/ask?tags=opalrb)
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
See the website for more detailed instructions and guides for Rails, jQuery, Sinatra, rack, CDN, etc. [http://opalrb.
|
22
|
+
See the website for more detailed instructions and guides for Rails, jQuery, Sinatra, rack, CDN, etc. [http://opalrb.com](http://opalrb.com).
|
23
23
|
|
24
24
|
### Compiling Ruby code with the CLI (Command Line Interface)
|
25
25
|
|
@@ -102,8 +102,8 @@ your web applications.
|
|
102
102
|
<html>
|
103
103
|
<head>
|
104
104
|
<meta charset="utf-8">
|
105
|
-
<script src="http://cdn.opalrb.
|
106
|
-
<script src="http://cdn.opalrb.
|
105
|
+
<script src="http://cdn.opalrb.com/opal/current/opal.js"></script>
|
106
|
+
<script src="http://cdn.opalrb.com/opal/current/opal-parser.js"></script>
|
107
107
|
<script type="text/javascript">Opal.load('opal-parser')</script>
|
108
108
|
|
109
109
|
<script type="text/ruby">
|
data/appveyor.yml
CHANGED
data/benchmark/benchmarks
CHANGED
@@ -6,7 +6,7 @@ test/cruby/benchmark/bm_app_fib.rb
|
|
6
6
|
#[too long] test/cruby/benchmark/bm_app_lc_fizzbuzz.rb
|
7
7
|
#[error] test/cruby/benchmark/bm_app_mandelbrot.rb
|
8
8
|
#[too long] test/cruby/benchmark/bm_app_pentomino.rb
|
9
|
-
test/cruby/benchmark/bm_app_raise.rb
|
9
|
+
#[longish] test/cruby/benchmark/bm_app_raise.rb
|
10
10
|
test/cruby/benchmark/bm_app_strconcat.rb
|
11
11
|
test/cruby/benchmark/bm_app_tak.rb
|
12
12
|
test/cruby/benchmark/bm_app_tarai.rb
|
@@ -32,12 +32,12 @@ test/cruby/benchmark/bm_loop_whileloop2.rb
|
|
32
32
|
test/cruby/benchmark/bm_loop_whileloop.rb
|
33
33
|
#[error] test/cruby/benchmark/bm_securerandom.rb
|
34
34
|
test/cruby/benchmark/bm_so_ackermann.rb
|
35
|
-
test/cruby/benchmark/bm_so_array.rb
|
35
|
+
#[<30] test/cruby/benchmark/bm_so_array.rb
|
36
36
|
#[error] test/cruby/benchmark/bm_so_binary_trees.rb
|
37
37
|
#[error] test/cruby/benchmark/bm_so_concatenate.rb
|
38
38
|
#[error] test/cruby/benchmark/bm_so_count_words.rb
|
39
|
-
test/cruby/benchmark/bm_so_exception.rb
|
40
|
-
test/cruby/benchmark/bm_so_fannkuch.rb
|
39
|
+
#[longish] test/cruby/benchmark/bm_so_exception.rb
|
40
|
+
#[longish] test/cruby/benchmark/bm_so_fannkuch.rb
|
41
41
|
#[error] test/cruby/benchmark/bm_so_fasta.rb
|
42
42
|
#[error] test/cruby/benchmark/bm_so_k_nucleotide.rb
|
43
43
|
test/cruby/benchmark/bm_so_lists.rb
|
@@ -53,7 +53,7 @@ test/cruby/benchmark/bm_so_object.rb
|
|
53
53
|
#[error] test/cruby/benchmark/bm_so_pidigits.rb
|
54
54
|
test/cruby/benchmark/bm_so_random.rb
|
55
55
|
#[error] test/cruby/benchmark/bm_so_reverse_complement.rb
|
56
|
-
test/cruby/benchmark/bm_so_sieve.rb
|
56
|
+
#[<30] test/cruby/benchmark/bm_so_sieve.rb
|
57
57
|
#[error] test/cruby/benchmark/bm_so_spectralnorm.rb
|
58
58
|
test/cruby/benchmark/bm_vm1_attr_ivar.rb
|
59
59
|
test/cruby/benchmark/bm_vm1_attr_ivar_set.rb
|
@@ -87,9 +87,9 @@ test/cruby/benchmark/bm_vm2_newlambda.rb
|
|
87
87
|
test/cruby/benchmark/bm_vm2_poly_method_ov.rb
|
88
88
|
test/cruby/benchmark/bm_vm2_poly_method.rb
|
89
89
|
test/cruby/benchmark/bm_vm2_proc.rb
|
90
|
-
test/cruby/benchmark/bm_vm2_raise1.rb
|
91
|
-
test/cruby/benchmark/bm_vm2_raise2.rb
|
92
|
-
test/cruby/benchmark/bm_vm2_regexp.rb
|
90
|
+
#[longish] test/cruby/benchmark/bm_vm2_raise1.rb
|
91
|
+
#[longish] test/cruby/benchmark/bm_vm2_raise2.rb
|
92
|
+
#[error] test/cruby/benchmark/bm_vm2_regexp.rb
|
93
93
|
test/cruby/benchmark/bm_vm2_send.rb
|
94
94
|
test/cruby/benchmark/bm_vm2_struct_big_aref_hi.rb
|
95
95
|
test/cruby/benchmark/bm_vm2_struct_big_aref_lo.rb
|
data/benchmark/run.rb
CHANGED
@@ -15,6 +15,8 @@ if files.empty?
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
files = files.shuffle
|
19
|
+
|
18
20
|
maxlen = files.max_by{|file| file.length}.length + 1
|
19
21
|
|
20
22
|
total_time = 0
|
@@ -25,14 +27,19 @@ files.each do |file|
|
|
25
27
|
times = []
|
26
28
|
|
27
29
|
if RUBY_ENGINE == 'opal'
|
28
|
-
code =
|
30
|
+
code = File.read(file)
|
31
|
+
code = "Benchmark.measure { #{code} }"
|
32
|
+
code = Opal.compile(code, file: file)
|
33
|
+
|
29
34
|
BEST_OF_N.times do
|
30
|
-
times <<
|
35
|
+
times << `eval(code)`
|
31
36
|
end
|
32
37
|
else
|
33
38
|
code = File.read(file)
|
39
|
+
code = "Benchmark.measure { #{code} }"
|
40
|
+
|
34
41
|
BEST_OF_N.times do
|
35
|
-
times <<
|
42
|
+
times << eval(code)
|
36
43
|
end
|
37
44
|
end
|
38
45
|
|
data/docs/compiled_ruby.md
CHANGED
@@ -270,7 +270,7 @@ as used by this example.
|
|
270
270
|
|
271
271
|
_Reposted from: [Mikamayhem](http://dev.mikamai.com/post/79398725537/using-native-javascript-objects-from-opal)_
|
272
272
|
|
273
|
-
Opal standard lib (stdlib) includes a `Native` module. To use it, you need to download and reference `native.js`. You can find the latest minified one from the CDN [here](http://cdn.opalrb.
|
273
|
+
Opal standard lib (stdlib) includes a `Native` module. To use it, you need to download and reference `native.js`. You can find the latest minified one from the CDN [here](http://cdn.opalrb.com/opal/current/native.min.js).
|
274
274
|
|
275
275
|
Let's see how it works and wrap `window`:
|
276
276
|
|
data/lib/opal/builder.rb
CHANGED
@@ -68,6 +68,7 @@ module Opal
|
|
68
68
|
@path_reader ||= PathReader.new(Opal.paths, extensions.map{|e| [".#{e}", ".js.#{e}"]}.flatten)
|
69
69
|
@prerequired ||= []
|
70
70
|
@compiler_options ||= Opal::Config.compiler_options
|
71
|
+
@missing_require_severity ||= Opal::Config.missing_require_severity
|
71
72
|
|
72
73
|
@processed = []
|
73
74
|
end
|
@@ -104,6 +105,7 @@ module Opal
|
|
104
105
|
@path_reader = other.path_reader.dup
|
105
106
|
@prerequired = other.prerequired.dup
|
106
107
|
@compiler_options = other.compiler_options.dup
|
108
|
+
@missing_require_severity = other.missing_require_severity.to_sym
|
107
109
|
@processed = other.processed.dup
|
108
110
|
end
|
109
111
|
|
@@ -124,7 +126,7 @@ module Opal
|
|
124
126
|
attr_reader :processed
|
125
127
|
|
126
128
|
attr_accessor :processors, :path_reader, :compiler_options,
|
127
|
-
:stubs, :prerequired, :preload
|
129
|
+
:stubs, :prerequired, :preload, :missing_require_severity
|
128
130
|
|
129
131
|
|
130
132
|
|
@@ -168,13 +170,13 @@ module Opal
|
|
168
170
|
"\nAnd the following processors:\n"+
|
169
171
|
print_list[processors]
|
170
172
|
|
171
|
-
case
|
172
|
-
when :
|
173
|
+
case missing_require_severity
|
174
|
+
when :error then raise MissingRequire, message
|
173
175
|
when :warning then warn message
|
174
|
-
|
176
|
+
when :ignore then # noop
|
175
177
|
end
|
176
178
|
|
177
|
-
|
179
|
+
nil
|
178
180
|
end
|
179
181
|
end
|
180
182
|
|
@@ -188,10 +190,13 @@ module Opal
|
|
188
190
|
|
189
191
|
if source.nil?
|
190
192
|
message = "can't find file: #{filename.inspect}"
|
191
|
-
case
|
192
|
-
when :error
|
193
|
+
case missing_require_severity
|
194
|
+
when :error then raise LoadError, message
|
193
195
|
when :warning then warn "can't find file: #{filename.inspect}"
|
196
|
+
when :ignore then # noop
|
194
197
|
end
|
198
|
+
|
199
|
+
return # the handling is delegated to the runtime
|
195
200
|
end
|
196
201
|
|
197
202
|
path = path_from_filename(filename)
|
data/lib/opal/cli.rb
CHANGED
@@ -7,7 +7,7 @@ module Opal
|
|
7
7
|
class CLI
|
8
8
|
attr_reader :options, :file, :compiler_options, :evals, :load_paths, :argv,
|
9
9
|
:output, :requires, :gems, :stubs, :verbose, :port, :preload,
|
10
|
-
:filename, :debug, :no_exit, :lib_only
|
10
|
+
:filename, :debug, :no_exit, :lib_only, :missing_require_severity
|
11
11
|
|
12
12
|
class << self
|
13
13
|
attr_accessor :stdout
|
@@ -39,6 +39,9 @@ module Opal
|
|
39
39
|
@filename = options.fetch(:filename) { @file && @file.path }; options.delete(:filename)
|
40
40
|
|
41
41
|
@requires = options.delete(:requires) || []
|
42
|
+
|
43
|
+
@missing_require_severity = options.delete(:missing_require_severity) { Opal::Config.missing_require_severity }
|
44
|
+
|
42
45
|
@requires.unshift('opal') unless options.delete(:skip_opal_require)
|
43
46
|
|
44
47
|
@compiler_options = Hash[
|
@@ -85,7 +88,11 @@ module Opal
|
|
85
88
|
end
|
86
89
|
|
87
90
|
def create_builder
|
88
|
-
builder = Opal::Builder.new
|
91
|
+
builder = Opal::Builder.new(
|
92
|
+
stubs: stubs,
|
93
|
+
compiler_options: compiler_options,
|
94
|
+
missing_require_severity: missing_require_severity,
|
95
|
+
)
|
89
96
|
|
90
97
|
# --include
|
91
98
|
builder.append_paths(*load_paths)
|
data/lib/opal/cli_options.rb
CHANGED
@@ -119,6 +119,14 @@ module Opal
|
|
119
119
|
options[:dynamic_require_severity] = level.to_sym
|
120
120
|
end
|
121
121
|
|
122
|
+
missing_require_levels = %w[error warning ignore]
|
123
|
+
on('--missing-require LEVEL', missing_require_levels,
|
124
|
+
'Set level of missing require severity.',
|
125
|
+
"(default: error, values: #{missing_require_levels.join(', ')})"
|
126
|
+
) do |level|
|
127
|
+
options[:missing_require_severity] = level.to_sym
|
128
|
+
end
|
129
|
+
|
122
130
|
on('-P', '--map FILE', 'Enable/Disable source map') do |file|
|
123
131
|
options[:map] = file
|
124
132
|
end
|
@@ -20,7 +20,8 @@ module Opal
|
|
20
20
|
require 'tempfile'
|
21
21
|
tempfile = Tempfile.new('opal-applescript-runner-')
|
22
22
|
# tempfile = File.new('opal-applescript-runner.js', 'w') # for debugging
|
23
|
-
tempfile.
|
23
|
+
tempfile.puts code
|
24
|
+
tempfile.puts "'';" # OSAScript will output the last thing
|
24
25
|
tempfile.close
|
25
26
|
_successful = system_with_output('osascript', '-l', 'JavaScript', tempfile.path , *argv)
|
26
27
|
rescue Errno::ENOENT
|
@@ -5,9 +5,14 @@ module Opal
|
|
5
5
|
class Server
|
6
6
|
def initialize(options)
|
7
7
|
@output = options.fetch(:output, $stdout)
|
8
|
-
|
8
|
+
|
9
|
+
@port = options.fetch(:port, ENV['OPAL_CLI_RUNNERS_SERVER_PORT'] || 3000).to_i
|
10
|
+
|
11
|
+
@static_folder = options[:static_folder] || ENV['OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER']
|
12
|
+
@static_folder = @static_folder == true ? 'public' : @static_folder
|
13
|
+
@static_folder = File.expand_path(@static_folder) if @static_folder
|
9
14
|
end
|
10
|
-
attr_reader :output, :port, :server
|
15
|
+
attr_reader :output, :port, :server, :static_folder
|
11
16
|
|
12
17
|
def run(source, argv)
|
13
18
|
unless argv.empty?
|
@@ -18,8 +23,10 @@ module Opal
|
|
18
23
|
require 'webrick'
|
19
24
|
require 'logger'
|
20
25
|
|
26
|
+
app = build_app(source)
|
27
|
+
|
21
28
|
@server = Rack::Server.start(
|
22
|
-
:app => app
|
29
|
+
:app => app,
|
23
30
|
:Port => port,
|
24
31
|
:AccessLog => [],
|
25
32
|
:Logger => Logger.new(output)
|
@@ -30,27 +37,47 @@ module Opal
|
|
30
37
|
nil
|
31
38
|
end
|
32
39
|
|
33
|
-
def
|
34
|
-
|
40
|
+
def build_app(source)
|
41
|
+
app = App.new(source)
|
42
|
+
|
43
|
+
if static_folder
|
44
|
+
not_found = [404, {}, []]
|
45
|
+
app = Rack::Cascade.new([
|
46
|
+
Rack::Static.new(->_{not_found}, urls: [''], root: static_folder),
|
47
|
+
app,
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
app
|
52
|
+
end
|
53
|
+
|
54
|
+
class App
|
55
|
+
def initialize(source)
|
56
|
+
@source = source
|
57
|
+
end
|
58
|
+
|
59
|
+
BODY = <<-HTML
|
60
|
+
<!doctype html>
|
61
|
+
<html>
|
62
|
+
<head>
|
63
|
+
<meta charset="utf-8"/>
|
64
|
+
<script src="/cli_runner.js"></script>
|
65
|
+
</head>
|
66
|
+
</html>
|
67
|
+
HTML
|
68
|
+
|
69
|
+
def call(env)
|
35
70
|
case env['PATH_INFO']
|
36
71
|
when '/'
|
37
|
-
|
38
|
-
<!doctype html>
|
39
|
-
<html>
|
40
|
-
<head>
|
41
|
-
<meta charset="utf-8"/>
|
42
|
-
<script src="/cli_runner.js"></script>
|
43
|
-
</head>
|
44
|
-
</html>
|
45
|
-
HTML
|
46
|
-
[200, {}, [body]]
|
72
|
+
[200, {'Content-Type' => 'text/html'}, [BODY]]
|
47
73
|
when '/cli_runner.js'
|
48
|
-
[200, {'Content-Type' => 'text/javascript'}, [source]]
|
74
|
+
[200, {'Content-Type' => 'text/javascript'}, [@source]]
|
49
75
|
else
|
50
|
-
[404, {}, [
|
76
|
+
[404, {}, ['not found']]
|
51
77
|
end
|
52
78
|
end
|
53
79
|
end
|
80
|
+
|
54
81
|
end
|
55
82
|
end
|
56
83
|
end
|
data/lib/opal/config.rb
CHANGED
@@ -98,14 +98,31 @@ module Opal
|
|
98
98
|
# @return [true, false]
|
99
99
|
config_option :tainting_stubs_enabled, true, compiler_option: :tainting
|
100
100
|
|
101
|
-
# Set the error severity for when a require can't be
|
101
|
+
# Set the error severity for when a require can't be parsed at compile time.
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# # Opal code
|
105
|
+
# require "foo" + some_dynamic_value
|
106
|
+
#
|
107
|
+
# - `:error` will raise an error at compile time
|
108
|
+
# - `:warning` will print a warning on stderr at compile time
|
109
|
+
# - `:ignore` will skip the require silently at compile time
|
110
|
+
#
|
111
|
+
# @return [:error, :warning, :ignore]
|
112
|
+
config_option :dynamic_require_severity, :warning, compiler_option: :dynamic_require_severity, valid_values: %i[error warning ignore]
|
113
|
+
|
114
|
+
# Set the error severity for when a required file can't be found at build time.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
# # Opal code
|
118
|
+
# require "some_non_existen_file"
|
102
119
|
#
|
103
120
|
# - `:error` will raise an error at compile time
|
104
121
|
# - `:warning` will print a warning on stderr at compile time
|
105
122
|
# - `:ignore` will skip the require silently at compile time
|
106
123
|
#
|
107
124
|
# @return [:error, :warning, :ignore]
|
108
|
-
config_option :
|
125
|
+
config_option :missing_require_severity, :error, valid_values: %i[error warning ignore]
|
109
126
|
|
110
127
|
# Enable IRB support for making local variables across multiple compilations.
|
111
128
|
#
|
data/lib/opal/nodes/rescue.rb
CHANGED
data/lib/opal/rewriters/base.rb
CHANGED
@@ -5,12 +5,47 @@ require 'opal/ast/node'
|
|
5
5
|
module Opal
|
6
6
|
module Rewriters
|
7
7
|
class Base < ::Parser::AST::Processor
|
8
|
+
class DummyLocation
|
9
|
+
def node=(*)
|
10
|
+
end
|
11
|
+
|
12
|
+
def expression
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
def begin_pos
|
17
|
+
0
|
18
|
+
end
|
19
|
+
|
20
|
+
def end_pos
|
21
|
+
0
|
22
|
+
end
|
23
|
+
|
24
|
+
def source
|
25
|
+
''
|
26
|
+
end
|
27
|
+
|
28
|
+
def line
|
29
|
+
0
|
30
|
+
end
|
31
|
+
|
32
|
+
def column
|
33
|
+
0
|
34
|
+
end
|
35
|
+
|
36
|
+
def last_line
|
37
|
+
Float::INFINITY
|
38
|
+
end
|
39
|
+
end
|
40
|
+
DUMMY_LOCATION = DummyLocation.new
|
41
|
+
|
8
42
|
def s(type, *children)
|
9
|
-
|
43
|
+
loc = current_node ? current_node.loc : DUMMY_LOCATION
|
44
|
+
::Opal::AST::Node.new(type, children, location: loc)
|
10
45
|
end
|
11
46
|
|
12
47
|
def self.s(type, *children)
|
13
|
-
::Opal::AST::Node.new(type, children)
|
48
|
+
::Opal::AST::Node.new(type, children, location: DUMMY_LOCATION)
|
14
49
|
end
|
15
50
|
|
16
51
|
alias on_iter process_regular_node
|
@@ -58,6 +93,17 @@ module Opal
|
|
58
93
|
s(:begin, body, node)
|
59
94
|
end
|
60
95
|
end
|
96
|
+
|
97
|
+
# Store the current node for reporting.
|
98
|
+
attr_accessor :current_node
|
99
|
+
|
100
|
+
# Intercept the main call and assign current node.
|
101
|
+
def process(node)
|
102
|
+
self.current_node = node
|
103
|
+
super
|
104
|
+
ensure
|
105
|
+
self.current_node = nil
|
106
|
+
end
|
61
107
|
end
|
62
108
|
end
|
63
109
|
end
|
data/lib/opal/version.rb
CHANGED
data/opal/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
This is the Opal corelib implementation API documentation.
|
4
4
|
The whole corelib is loaded upon `require 'opal'`.
|
5
5
|
|
6
|
-
The `runtime.js` documentation is [available here](http://opalrb.
|
6
|
+
The `runtime.js` documentation is [available here](http://opalrb.com/docs/api/master/corelib/file.RUNTIME.html) (in master)
|
7
7
|
|
8
8
|
# Cherry-picking
|
9
9
|
|
data/opal/corelib/array.rb
CHANGED
@@ -2160,7 +2160,7 @@ class Array < `Array`
|
|
2160
2160
|
max ||= `row.length`
|
2161
2161
|
|
2162
2162
|
if `row.length` != max
|
2163
|
-
raise IndexError, "element size differs (#{`row.length`} should be #{max}"
|
2163
|
+
raise IndexError, "element size differs (#{`row.length`} should be #{max})"
|
2164
2164
|
end
|
2165
2165
|
|
2166
2166
|
`row.length`.times {|i|
|
data/opal/corelib/constants.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
RUBY_PLATFORM = 'opal'
|
2
2
|
RUBY_ENGINE = 'opal'
|
3
3
|
RUBY_VERSION = '2.4.0'
|
4
|
-
RUBY_ENGINE_VERSION = '0.11.
|
5
|
-
RUBY_RELEASE_DATE = '
|
4
|
+
RUBY_ENGINE_VERSION = '0.11.1.pre'
|
5
|
+
RUBY_RELEASE_DATE = '2018-07-04'
|
6
6
|
RUBY_PATCHLEVEL = 0
|
7
7
|
RUBY_REVISION = 0
|
8
8
|
RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2015 Adam Beynon'
|
data/opal/corelib/runtime.js
CHANGED
@@ -163,7 +163,7 @@
|
|
163
163
|
// - nesting: the namespaces wrapping the current scope, e.g. nesting inside
|
164
164
|
// `module A; module B::C; end; end` is `[B::C, A]`
|
165
165
|
|
166
|
-
// Get the
|
166
|
+
// Get the constant in the scope of the current cref
|
167
167
|
function const_get_name(cref, name) {
|
168
168
|
if (cref) return cref.$$const[name];
|
169
169
|
}
|
data/tasks/benchmarking.rake
CHANGED
@@ -1,25 +1,23 @@
|
|
1
1
|
namespace :bench do
|
2
2
|
directory "tmp/bench"
|
3
3
|
|
4
|
+
report_file_for = -> name {
|
5
|
+
index = Dir['tmp/bench/*'].map{|f| File.basename(f).to_i}.sort.last.to_i + 1
|
6
|
+
"tmp/bench/#{index}_#{name.gsub('.', '-')}.txt"
|
7
|
+
}
|
8
|
+
|
4
9
|
desc "Benchmark Opal"
|
5
10
|
task :opal => "tmp/bench" do |t, args|
|
11
|
+
require 'opal/version'
|
6
12
|
files = Array(args[:files]) + args.extras
|
7
|
-
|
8
|
-
begin
|
9
|
-
index += 1
|
10
|
-
report = "tmp/bench/Opal#{index}"
|
11
|
-
end while File.exist?(report)
|
13
|
+
report = report_file_for["opal-#{Opal::VERSION}"]
|
12
14
|
sh "bundle exec opal benchmark/run.rb #{files.join(" ")} | tee #{report}"
|
13
15
|
end
|
14
16
|
|
15
17
|
desc "Benchmark Ruby"
|
16
18
|
task :ruby => "tmp/bench" do |t, args|
|
17
19
|
files = Array(args[:files]) + args.extras
|
18
|
-
|
19
|
-
begin
|
20
|
-
index += 1
|
21
|
-
report = "tmp/bench/Ruby#{index}"
|
22
|
-
end while File.exist?(report)
|
20
|
+
report = report_file_for["ruby-#{RUBY_VERSION}"]
|
23
21
|
sh "bundle exec ruby benchmark/run.rb #{files.join(" ")} | tee #{report}"
|
24
22
|
end
|
25
23
|
|
@@ -54,22 +52,40 @@ namespace :bench do
|
|
54
52
|
|
55
53
|
header = ["Benchmark"]
|
56
54
|
reports.each do |report_name, _|
|
57
|
-
header << report_name
|
55
|
+
header << (report_name+' | ')
|
58
56
|
end
|
59
57
|
|
58
|
+
base_report_name, base_report_results = reports.to_a.first
|
59
|
+
puts "Base: #{base_report_name}"
|
60
|
+
|
60
61
|
table = [header]
|
62
|
+
result_rows = []
|
61
63
|
benchmark_names.each do |benchmark_name|
|
62
64
|
row = [benchmark_name]
|
63
|
-
reports.each do |
|
65
|
+
reports.each do |report_name, report_results|
|
66
|
+
results_string = ""
|
67
|
+
|
64
68
|
if report_results[benchmark_name]
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
sec = report_results[benchmark_name].to_f
|
70
|
+
|
71
|
+
if report_name != base_report_name && base_report_results[benchmark_name]
|
72
|
+
base_sec = base_report_results[benchmark_name].to_f
|
73
|
+
delta_percent = -((1 - sec/base_sec)*100)
|
74
|
+
results_string << format("%+0.2f%%", delta_percent).rjust(10).ljust(12)
|
75
|
+
else
|
76
|
+
results_string << (" "*14)
|
77
|
+
end
|
78
|
+
|
79
|
+
results_string << format("%0.3fms", sec).rjust(9)
|
68
80
|
end
|
81
|
+
results_string << ' | '
|
82
|
+
row << results_string
|
69
83
|
end
|
70
|
-
|
84
|
+
result_rows << row
|
71
85
|
end
|
72
86
|
|
87
|
+
table += result_rows.sort_by{|row| row[2].scan(/([\+|\-]\d+\.\d+)%/).flatten.first.to_f}
|
88
|
+
|
73
89
|
fmt = ""
|
74
90
|
table.transpose.each_with_index do |column, index|
|
75
91
|
column_width = column.max_by{|string| string.length}.length
|
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'opal-rspec', github: 'opal/opal-rspec', branch: '
|
3
|
+
gem 'opal-rspec', github: 'opal/opal-rspec', branch: 'master', submodules: true
|
4
4
|
gem 'opal-sprockets', github: 'opal/opal-sprockets'
|
5
5
|
gem 'opal', path: '../..'
|
6
6
|
gem 'rake'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sourcemap
|
@@ -749,14 +749,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
749
749
|
version: 2.0.0
|
750
750
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
751
751
|
requirements:
|
752
|
-
- - "
|
752
|
+
- - ">"
|
753
753
|
- !ruby/object:Gem::Version
|
754
|
-
version:
|
754
|
+
version: 1.3.1
|
755
755
|
requirements: []
|
756
756
|
rubyforge_project:
|
757
|
-
rubygems_version: 2.
|
757
|
+
rubygems_version: 2.7.4
|
758
758
|
signing_key:
|
759
759
|
specification_version: 4
|
760
760
|
summary: Ruby runtime and core library for JavaScript
|
761
761
|
test_files: []
|
762
|
-
has_rdoc:
|