opal 1.6.0.rc1 → 1.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bc96268e7c234e02e983299ec4e04de40283cd5dec33a944aca6567bddaf927
4
- data.tar.gz: 34a0a446e2c6a8564cb1ec9523a88acfaf667f2b35d77aebde437e5658eb8b95
3
+ metadata.gz: 1c701c29f145e065c4abcaf8ab8884b6c72bc2d4b7f1a4c20dd293e05b4ab824
4
+ data.tar.gz: c42cd06d101ed3cab5b7c116f87bb8de200b1eaacee107228f2cad20a6bde94d
5
5
  SHA512:
6
- metadata.gz: 470926fc4eb90e7effc90cc193fdf80746f26ecffff79ddd602c7c275e2e17638206a230079370f3fd30923f00988bd497f1ec38914ae50fa49a90ff76ab14a6
7
- data.tar.gz: 83fa53a8d529538c321dad65ba704e4ec3fd4ab92e8de57a2865fb1da38a205008729eddd5444e1f7c15ef19cc11f228e0cad9d692e32c558cf346fac62c1c66
6
+ metadata.gz: cb68516917eccc5b981fed3f71b31ddd96378a0bc5d7a56d3d8d0728b80dee4dbe0fb7f00b998e4c85a87cd8a6925268046b817f9741ef015ef17f8d7e18f922
7
+ data.tar.gz: f296bfaa2d953d3b966bda9b6ae3ebff0b43d711c60a4816810adcc091afcec09608a3c7895b156b8267bfac99dd67e93f9868100356939e92bbd9609a715a60
data/CHANGELOG.md CHANGED
@@ -10,11 +10,90 @@ Changes are grouped as follows:
10
10
  - **Removed** for deprecated features removed in this release.
11
11
  - **Fixed** for any bug fixes.
12
12
  - **Security** to invite users to upgrade in case of vulnerabilities.
13
+ - **Performance** changes related to speed and efficiency.
13
14
 
14
15
 
15
16
 
16
17
 
17
18
 
19
+ ## [1.6.1](https://github.com/opal/opal/compare/v1.6.0...v1.6.1) - 2022-12-09
20
+
21
+
22
+ <!--
23
+ ### Internal
24
+ ### Changed
25
+ ### Added
26
+ ### Removed
27
+ ### Deprecated
28
+ ### Performance
29
+ ### Fixed
30
+ -->
31
+
32
+ ### Fixed
33
+
34
+ - Fix builder.dup breaking Tilt support ([#2479](https://github.com/opal/opal/pull/2479))
35
+
36
+ ### Changed
37
+
38
+ - Build also opal variants for the CDN: opal/mini.js etc. ([#2489](https://github.com/opal/opal/pull/2489))
39
+
40
+
41
+
42
+
43
+ ## [1.6.0](https://github.com/opal/opal/compare/v1.5.1...v1.6.0) - 2022-11-24
44
+
45
+
46
+ ### Changed
47
+
48
+ - No longer truncate stacktraces to 15 lines ([#2440](https://github.com/opal/opal/pull/2440))
49
+ - Mark async/await as non-experimental ([#2477](https://github.com/opal/opal/pull/2477))
50
+
51
+ ### Performance
52
+
53
+ - Improve method block performance for runtime ([#2449](https://github.com/opal/opal/pull/2449))
54
+ - Uninline non-typical argument handling ([#2419](https://github.com/opal/opal/pull/2419))
55
+ - Logic optimization of runtime.js ([#2415](https://github.com/opal/opal/pull/2415))
56
+ - Windows support for `performance:compare` CI check ([#2450](https://github.com/opal/opal/pull/2450))
57
+ - Improve block performance for even more cases ([#2465](https://github.com/opal/opal/pull/2465))
58
+
59
+ ### Added
60
+
61
+ - Added support for `#freeze` and `#frozen?` (#2444, #2468)
62
+ - Add CLI support for ESM, at least for Chrome, NodeJS, QuickJS and GJS ([#2435](https://github.com/opal/opal/pull/2435))
63
+ - Support exit in Chrome CLI Runner, both sync and async ([#2439](https://github.com/opal/opal/pull/2439))
64
+ - Make sure the Server CLI Runner can pick up changes in sources ([#2436](https://github.com/opal/opal/pull/2436))
65
+ - Delegate and ruby2_keywords ([#2446](https://github.com/opal/opal/pull/2446))
66
+ - Source code can now be embedded in the compiled file to improve development/debugging, e.g. RSpec reports, `Proc#source_location` ([#2440](https://github.com/opal/opal/pull/2440))
67
+ - Added `Kernel#caller_locations` ([#2440](https://github.com/opal/opal/pull/2440))
68
+ - `Opal::Builder::Prefork` for blazingly fast multicore compilation times (#2263, #2462, #2454, #2469, #2475)
69
+ - Add `Opal::BuilderProcessors::RubyERBProcessor` ([#2470](https://github.com/opal/opal/pull/2470))
70
+
71
+ ### Fixed
72
+
73
+ - Closure tracking support fixes a whole array of bugs handling `break` / `next` / `retry` / … ([#2357](https://github.com/opal/opal/pull/2357))
74
+ - Fix an edge case of if in the most complex form not returning ([#2433](https://github.com/opal/opal/pull/2433))
75
+ - `String#length` is now available when using `opal/mini` ([#2438](https://github.com/opal/opal/pull/2438))
76
+ - Auto-await produced invalid code ([#2440](https://github.com/opal/opal/pull/2440))
77
+ - Fix `Enumerable#collect_concat` and `#flat_map` implementation ([#2440](https://github.com/opal/opal/pull/2440))
78
+ - Improved await support for PromiseV1 ([#2440](https://github.com/opal/opal/pull/2440))
79
+ - Compilation error occurs while compiling `being/end` returning a `case/when` ([#2459](https://github.com/opal/opal/pull/2459))
80
+ - Ensure UTF-8 encoding of `.sourcesContent` of source maps ([#2451](https://github.com/opal/opal/pull/2451))
81
+ - Benchmarks require string/unpack ([#2453](https://github.com/opal/opal/pull/2453))
82
+ - Fix compilation of a call: `gets&.chomp` ([#2473](https://github.com/opal/opal/pull/2473))
83
+ - Fix specs on Windows ([#2460](https://github.com/opal/opal/pull/2460))
84
+ - Make opal CLI tool work again with pipes ([#2474](https://github.com/opal/opal/pull/2474))
85
+
86
+ ### Internal
87
+
88
+ - GitHub Workflows security hardening ([#2432](https://github.com/opal/opal/pull/2432))
89
+ - Retry if file cache write operation exits with Zlib::BufError ([#2463](https://github.com/opal/opal/pull/2463))
90
+ - Eliminate redundant `var constructor` in `allocate_class` ([#2452](https://github.com/opal/opal/pull/2452))
91
+ - Fix `performance:compare` asset size calculation ([#2457](https://github.com/opal/opal/pull/2457))
92
+ - Fix a few specs after the Opal RSpec 1.0 (alpha) release (#2471, #2472)
93
+
94
+
95
+
96
+
18
97
  ## [1.5.1](https://github.com/opal/opal/compare/v1.5.0...v1.5.1) - 2022-07-20
19
98
 
20
99
 
@@ -24,6 +103,11 @@ Changes are grouped as follows:
24
103
  - Fix exception during `Hash#each_value` if keys get deleted during loop ([#2427](https://github.com/opal/opal/pull/2427))
25
104
  - Fix scan_until and check_until implementation of StringScanner ([#2420](https://github.com/opal/opal/pull/2420))
26
105
 
106
+ ## New Contributors
107
+ * @Leon0402 made their first contribution in https://github.com/opal/opal/pull/2420
108
+
109
+ **Full Changelog**: https://github.com/opal/opal/compare/v1.5.0...v1.5.1
110
+
27
111
 
28
112
 
29
113
 
data/Gemfile CHANGED
@@ -10,6 +10,7 @@ rack_version = ENV['RACK_VERSION']
10
10
  sprockets_version = ENV['SPROCKETS_VERSION']
11
11
 
12
12
  gem 'json', '< 1.8.1', platform: :ruby if ruby_version < v['2.2']
13
+ gem 'psych', '< 5.0.0', platform: :ruby if ruby_version < v['3.2a']
13
14
  gem 'rack-test', '< 0.8' if ruby_version <= v['2.0']
14
15
  gem 'coveralls', platform: :mri
15
16
 
data/UNRELEASED.md CHANGED
@@ -7,50 +7,3 @@
7
7
  ### Performance
8
8
  ### Fixed
9
9
  -->
10
-
11
- ### Changed
12
-
13
- - No longer truncate stacktraces to 15 lines (#2440)
14
-
15
- ### Performance
16
-
17
- - Improve method block performance for runtime (#2449)
18
- - Uninline non-typical argument handling (#2419)
19
- - Logic optimization of runtime.js (#2415)
20
- - Windows support for `performance:compare` CI check (#2450)
21
- - Improve block performance for even more cases (#2465)
22
-
23
- ### Added
24
-
25
- - Added support for `#freeze` and `#frozen?` (#2444, #2468)
26
- - Add CLI support for ESM, at least for Chrome, NodeJS, QuickJS and GJS (#2435)
27
- - Support exit in Chrome CLI Runner, both sync and async (#2439)
28
- - Make sure the Server CLI Runner can pick up changes in sources (#2436)
29
- - Delegate and ruby2_keywords (#2446)
30
- - Source code can now be embedded in the compiled file to improve development/debugging, e.g. RSpec reports, `Proc#source_location` (#2440)
31
- - Added `Kernel#caller_locations` (#2440)
32
- - `Opal::Builder::Prefork` for blazingly fast multicore compilation times (#2263, #2462, #2454, #2469, #2475)
33
- - Add `Opal::BuilderProcessors::RubyERBProcessor` (#2470)
34
-
35
- ### Fixed
36
-
37
- - Closure tracking support fixes a whole array of bugs handling `break` / `next` / `retry` / … (#2357)
38
- - Fix an edge case of if in the most complex form not returning (#2433)
39
- - `String#length` is now available when using `opal/mini` (#2438)
40
- - Auto-await produced invalid code (#2440)
41
- - Fix `Enumerable#collect_concat` and `#flat_map` implementation (#2440)
42
- - Improved await support for PromiseV1 (#2440)
43
- - Compilation error occurs while compiling `being/end` returning a `case/when` (#2459)
44
- - Ensure UTF-8 encoding of `.sourcesContent` of source maps (#2451)
45
- - Benchmarks require string/unpack (#2453)
46
- - Fix compilation of a call: `gets&.chomp` (#2473)
47
- - Fix specs on Windows (#2460)
48
- - Make opal CLI tool work again with pipes (#2474)
49
-
50
- ### Internal
51
-
52
- - GitHub Workflows security hardening (#2432)
53
- - Retry if file cache write operation exits with Zlib::BufError (#2463)
54
- - Eliminate redundant `var constructor` in `allocate_class` (#2452)
55
- - Fix `performance:compare` asset size calculation (#2457)
56
- - Fix a few specs after the Opal RSpec 1.0 (alpha) release (#2471, #2472)
data/docs/async.md CHANGED
@@ -1,16 +1,5 @@
1
1
  # Asynchronous code (PromiseV2 / async / await)
2
2
 
3
- Please be aware that this functionality is marked as experimental and may change
4
- in the future.
5
-
6
- In order to disable the warnings that will be shown if you use those experimental
7
- features, add the following line before requiring `promise/v2` or `await` and after
8
- requiring `opal`.
9
-
10
- ```ruby
11
- `Opal.config.experimental_features_severity = 'ignore'`
12
- ```
13
-
14
3
  ## PromiseV2
15
4
 
16
5
  In Opal 1.2 we introduced PromiseV2 which is to replace the default Promise in Opal 2.0
@@ -52,7 +41,7 @@ require "await"
52
41
 
53
42
  def wait_5_seconds
54
43
  puts "Let's wait 5 seconds..."
55
- sleep(5).await
44
+ sleep(5).__await__
56
45
  puts "Done!"
57
46
  end
58
47
 
@@ -60,14 +49,11 @@ wait_5_seconds.__await__
60
49
  ```
61
50
 
62
51
  It's important to understand what happens under the hood: every scope in which `#__await__` is
63
- encountered will become async, which means that it will return a Promise that will resolve
52
+ encountered will become async, which means that it will return a PromiseV2 that will resolve
64
53
  to a value. This includes methods, blocks and the top scope. This means, that `#__await__` is
65
54
  infectious and you need to remember to `#__await__` everything along the way, otherwise
66
55
  a program will finish too early and the values may be incorrect.
67
56
 
68
- [You can take a look at how we ported Minitest to support asynchronous tests.](https://github.com/opal/opal/pull/2221/commits/8383c7b45a94fe4628778f429508b9c08c8948b0) Take note, that
69
- it was ported to use `#await` while the finally accepted version uses `#__await__`.
70
-
71
57
  It is certainly correct to `#__await__` any value, including non-Promises, for instance
72
58
  `5.__await__` will correctly resolve to `5` (except that it will make the scope an async
73
59
  function, with all the limitations described above).
@@ -76,6 +62,8 @@ The `await` stdlib module includes a few useful functions, like async-aware `eac
76
62
  function and `sleep` that doesn't block the thread. It also includes a method `#await`
77
63
  which is an alias of `#itself` - it makes sense to auto-await that method.
78
64
 
65
+ [You can take a look at how we ported Minitest to support asynchronous tests.](https://github.com/opal/opal/pull/2221/files#diff-bdc8868ad4476bff7b25475f1b19059ac684d64c6531a645b3ba0aef0c466d0f).
66
+
79
67
  This approach is certainly incompatible with what Ruby does, but due to a dynamic nature
80
68
  of Ruby and a different model of JavaScript this was the least invasive way to catch up
81
69
  with the latest JavaScript trends and support `Promise` heavy APIs and asynchronous code.
@@ -106,4 +94,4 @@ require "await"
106
94
  p i
107
95
  sleep i
108
96
  end
109
- ```
97
+ ```
data/docs/releasing.md CHANGED
@@ -18,14 +18,14 @@ _This guide is a work-in-progress._
18
18
  - Commit the updated changelog along with the version bump using this commit message:
19
19
  "Release v1.2.3"
20
20
  - Push the commit and run `bin/rake release` to release the new version to Rubygems
21
- - Go to GitHub releases and create a new release from the latest tag pasting the contents from CHANGELOG.md
21
+ - Go to GitHub releases and create a new release from the latest tag pasting the contents from CHANGELOG.md (or UNRELEASED.md for pre-releases)
22
22
 
23
23
  ## Opal docs
24
24
 
25
25
  - Open `opal-docs` and run `bin/build v1.2.3`
26
26
  - Then run `bin/deploy`
27
27
 
28
- ## Opal site
28
+ ## [skip for pre-releases] Opal site
29
29
 
30
30
  - Open `opal.github.io` and update the opal version in the `Gemfile`
31
31
  - run `bin/build`
@@ -35,9 +35,8 @@ _This guide is a work-in-progress._
35
35
 
36
36
  - Run `bin/release v1.2.3`
37
37
 
38
- ## Prepare for the next release
38
+ ## [skip for minor-releases] Prepare for the next release
39
39
 
40
- - Skip this step if releasing a stable release
41
40
  - Create a new pull request that:
42
41
  - Updates a version to `v1.x.0.dev` in both `lib/opal/version.rb` and `opal/corelib/constants.rb`
43
42
  - Remember to merge that PR before merging anything else next once we decide to not release any more point releases from `master`.
data/lib/opal/builder.rb CHANGED
@@ -123,6 +123,7 @@ module Opal
123
123
  @compiler_options = other.compiler_options.dup
124
124
  @missing_require_severity = other.missing_require_severity.to_sym
125
125
  @processed = other.processed.dup
126
+ @scheduler = other.scheduler.dup.tap { |i| i.builder = self }
126
127
  end
127
128
 
128
129
  def to_s
@@ -175,7 +176,7 @@ module Opal
175
176
  attr_reader :processed
176
177
 
177
178
  attr_accessor :processors, :path_reader, :stubs, :prerequired, :preload,
178
- :compiler_options, :missing_require_severity, :cache
179
+ :compiler_options, :missing_require_severity, :cache, :scheduler
179
180
 
180
181
  def esm?
181
182
  @compiler_options[:esm]
@@ -8,7 +8,7 @@ module Opal
8
8
  @builder = builder
9
9
  end
10
10
 
11
- attr_reader :builder
11
+ attr_accessor :builder
12
12
  end
13
13
 
14
14
  singleton_class.attr_accessor :builder_scheduler
data/lib/opal/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  module Opal
4
4
  # WHEN RELEASING:
5
5
  # Remember to update RUBY_ENGINE_VERSION in opal/corelib/constants.rb too!
6
- VERSION = '1.6.0.rc1'
6
+ VERSION = '1.6.1'
7
7
  end
@@ -1,8 +1,8 @@
1
1
  ::RUBY_PLATFORM = 'opal'
2
2
  ::RUBY_ENGINE = 'opal'
3
3
  ::RUBY_VERSION = '3.1.0'
4
- ::RUBY_ENGINE_VERSION = '1.6.0.rc1'
5
- ::RUBY_RELEASE_DATE = '2022-11-18'
4
+ ::RUBY_ENGINE_VERSION = '1.6.1'
5
+ ::RUBY_RELEASE_DATE = '2022-12-09'
6
6
  ::RUBY_PATCHLEVEL = 0
7
7
  ::RUBY_REVISION = '0'
8
8
  ::RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2022 Adam Beynon and the Opal contributors'
@@ -68,6 +68,16 @@ RSpec.describe Opal::Builder do
68
68
  b2.send(m).should_not equal(builder.send(m))
69
69
  end
70
70
  end
71
+
72
+ it 'processes dependencies correctly' do
73
+ b2 = builder
74
+ 2.times do
75
+ b2 = b2.dup
76
+ source = 'require "json"'
77
+ b2.build_str(source, 'bar.rb')
78
+ b2.to_s.should include("$to_json")
79
+ end
80
+ end
71
81
  end
72
82
 
73
83
  describe 'requiring a native .js file' do
data/stdlib/await.rb CHANGED
@@ -1,13 +1,6 @@
1
1
  # helpers: coerce_to
2
2
  # await: await
3
3
 
4
- if `Opal.config.experimental_features_severity == 'warning'`
5
- warn 'Await functionality is a technology preview, which means it may change its behavior ' \
6
- 'in the future unless this warning is removed. If you are interested in this part, ' \
7
- 'please make sure you track the async/await/promises tag on Opal issues: ' \
8
- 'https://github.com/opal/opal/issues?q=label%3Aasync%2Fawait%2Fpromises'
9
- end
10
-
11
4
  %x{
12
5
  var AsyncFunction = Object.getPrototypeOf(async function() {}).constructor;
13
6
  }
data/tasks/building.rake CHANGED
@@ -15,6 +15,7 @@ DESC
15
15
  task :dist do
16
16
  require 'opal/util'
17
17
  require 'opal/config'
18
+ require 'fileutils'
18
19
 
19
20
  Opal::Config.arity_check_enabled = false
20
21
  Opal::Config.const_missing_enabled = false
@@ -23,7 +24,8 @@ task :dist do
23
24
 
24
25
  build_dir = ENV['DIR'] || 'build'
25
26
  files = ENV['FILES'] ? ENV['FILES'].split(',') :
26
- Dir['{opal,stdlib}/*.rb'].map { |lib| File.basename(lib, '.rb') }
27
+ Dir['{opal,stdlib}/*.rb'].map { |lib| File.basename(lib, '.rb') } +
28
+ Dir['opal/opal/*.rb'].map { |lib| 'opal/' + File.basename(lib, '.rb') }
27
29
  formats = (ENV['FORMATS'] || 'js,min,gz').split(',')
28
30
 
29
31
  mkdir_p build_dir unless File.directory? build_dir
@@ -36,7 +38,7 @@ task :dist do
36
38
  $stdout.flush
37
39
 
38
40
  # Set requirable to true, unless building opal. This allows opal to be auto-loaded.
39
- requirable = (lib != 'opal')
41
+ requirable = (%w[opal opal/mini opal/base].include? lib)
40
42
  builder = Opal::Builder.build(lib, requirable: requirable)
41
43
 
42
44
  src = builder.to_s if (formats & %w[js min gz]).any?
@@ -44,6 +46,8 @@ task :dist do
44
46
  min = Opal::Util.uglify src if (formats & %w[min gz]).any?
45
47
  gzp = Opal::Util.gzip min if (formats & %w[gz]).any?
46
48
 
49
+ FileUtils.mkdir_p(File.dirname("#{build_dir}/#{lib}.js"))
50
+
47
51
  File.open("#{build_dir}/#{lib}.js", 'w+') { |f| f << src }
48
52
  File.open("#{build_dir}/#{lib}.min.js", 'w+') { |f| f << min } if min
49
53
  File.open("#{build_dir}/#{lib}.min.js.gz", 'w+') { |f| f << gzp } if gzp
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: 1.6.0.rc1
4
+ version: 1.6.1
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: 2022-11-18 00:00:00.000000000 Z
13
+ date: 2022-12-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ast
@@ -1169,10 +1169,10 @@ licenses:
1169
1169
  metadata:
1170
1170
  homepage_uri: https://opalrb.com/
1171
1171
  bug_tracker_uri: https://github.com/opal/opal/issues
1172
- changelog_uri: https://github.com/opal/opal/blob/v1.6.0.rc1/CHANGELOG.md
1173
- readme_uri: https://github.com/opal/opal/blob/v1.6.0.rc1/README.md
1174
- api_documentation_uri: http://opalrb.com/docs/api/v1.6.0.rc1/index.html
1175
- guides_uri: http://opalrb.com/docs/guides/v1.6.0.rc1/index.html
1172
+ changelog_uri: https://github.com/opal/opal/blob/v1.6.1/CHANGELOG.md
1173
+ readme_uri: https://github.com/opal/opal/blob/v1.6.1/README.md
1174
+ api_documentation_uri: http://opalrb.com/docs/api/v1.6.1/index.html
1175
+ guides_uri: http://opalrb.com/docs/guides/v1.6.1/index.html
1176
1176
  chat_uri: https://gitter.im/opal/opal
1177
1177
  source_code_uri: https://github.com/opal/opal
1178
1178
  post_install_message:
@@ -1186,11 +1186,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
1186
1186
  version: '2.3'
1187
1187
  required_rubygems_version: !ruby/object:Gem::Requirement
1188
1188
  requirements:
1189
- - - ">"
1189
+ - - ">="
1190
1190
  - !ruby/object:Gem::Version
1191
- version: 1.3.1
1191
+ version: '0'
1192
1192
  requirements: []
1193
- rubygems_version: 3.3.22
1193
+ rubygems_version: 3.3.26
1194
1194
  signing_key:
1195
1195
  specification_version: 4
1196
1196
  summary: Ruby runtime and core library for JavaScript