opal 1.7.1 → 1.7.2

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: 3867be8330f4fc45cb5ea9a759c3a1fd39880c5ea92e3c054cbfb2e8776d3f45
4
- data.tar.gz: 9bae6c750966bc7e9551f5c4e6d21ce751ee66fc69862bae5b98b85299de7343
3
+ metadata.gz: 3221ae5854f26b0d0722ddf2689773633648086a616add372e8fdd617b31d7c0
4
+ data.tar.gz: b6b4a65b1905bddb6c1fd2310b13c03600ef4bb8fb416fff54e5499bfae8616c
5
5
  SHA512:
6
- metadata.gz: 56d87d05c1c043e165b30181b26a7c761d24d9168474fdcece06ca23ee5b4133d8d58722d9e3446f63db666d15acdc2bbcaf870b237f11673d7c6d810149dd1e
7
- data.tar.gz: c7f9ced16e1b43ca58c75d7405319c6a5c8d008fa43db6cc1281d235bae1bce090a617d21234c3807ae5d3663b9b268799a87fb4da30f2afc8587a16d5185f7d
6
+ metadata.gz: 5a009bcca000c8fef3d73cda99453023b2860615e4c4c7176e328448cd12d5f26bbf6d2809ca040f064e64af7b04ddb94857b35ac36486a0c7996be28a63230b
7
+ data.tar.gz: d9154247ad9e90fbc770d647524db30fc8132b3fb77f8c5115abb67a3507fe66c0f7306a2965f1aca11bc790b2f6b7308d7db7bda7e9c3443b54bce42a957bab
data/CHANGELOG.md CHANGED
@@ -16,7 +16,7 @@ Changes are grouped as follows:
16
16
 
17
17
 
18
18
 
19
- ## [1.7.1](https://github.com/opal/opal/compare/v1.7.0...v1.7.1) - 2023-01-06
19
+ ## [1.7.2](https://github.com/opal/opal/compare/v1.7.1...v1.7.2) - 2023-01-20
20
20
 
21
21
 
22
22
  <!--
@@ -29,6 +29,16 @@ Changes are grouped as follows:
29
29
  ### Fixed
30
30
  -->
31
31
 
32
+ ### Fixed
33
+
34
+ - Fix the `--debug-source-map` CLI option ([#2520](https://github.com/opal/opal/pull/2520))
35
+ - Fix links in `docs/compiler.md` ([#2519](https://github.com/opal/opal/pull/2519))
36
+
37
+
38
+
39
+
40
+ ## [1.7.1](https://github.com/opal/opal/compare/v1.7.0...v1.7.1) - 2023-01-05
41
+
32
42
 
33
43
  ### Added
34
44
 
data/UNRELEASED.md CHANGED
@@ -7,3 +7,4 @@
7
7
  ### Performance
8
8
  ### Fixed
9
9
  -->
10
+
data/docs/cdp_common.md CHANGED
@@ -1,4 +1,4 @@
1
- ### Common CDP of Chrome, Firefox, Node and Deno
1
+ # Common CDP of Chrome, Firefox, Node and Deno
2
2
 
3
3
  cdp_common.json documents a subset of the common CDP as reported by Chrome, version 107 and Firefox, version 106.
4
4
  All entries that where marked as "experimental" or "deprecated" have been removed.
data/docs/compiler.md CHANGED
@@ -27,7 +27,7 @@ code as well as a reference back to the original sexp which is useful for
27
27
  generating source maps afterwards.
28
28
 
29
29
 
30
- [sexps]: https://github.com/opal/opal/tree/master/lib/opal/parser/sexp.rb
30
+ [parser]: https://github.com/opal/opal/tree/master/lib/opal/parser.rb
31
31
  [compiler]: https://github.com/opal/opal/tree/master/lib/opal/compiler.rb
32
32
  [fragments]: https://github.com/opal/opal/tree/master/lib/opal/fragment.rb
33
33
  [base-node]: https://github.com/opal/opal/tree/master/lib/opal/nodes/base.rb
data/docs/releasing.md CHANGED
@@ -2,40 +2,56 @@
2
2
 
3
3
  _This guide is a work-in-progress._
4
4
 
5
- ## Updating the version
5
+ ---
6
+
7
+ ## Before the release
8
+
9
+ All of the following is now covered by `bin/rake release:prepare VERSION=v1.2.3`
10
+
11
+ ### Updating the version
6
12
 
7
13
  - Update `lib/opal/version.rb`
8
14
  - Update `opal/corelib/constants.rb` with the same version number along with release dates
9
15
 
10
- ## Updating the changelog
16
+ ### Updating the changelog
11
17
 
12
18
  - Ensure all the unreleased changes are documented in UNRELEASED.md
13
19
  - [skip for pre-releases] Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
14
20
  - [skip for pre-releases] Empty UNRELEASED.md
15
21
 
16
- ## The commit
22
+ ### The commit
17
23
 
18
24
  - Commit the updated changelog along with the version bump using this commit message:
19
25
  "Release v1.2.3"
20
- - Push the commit and run `bin/rake release` to release the new version to Rubygems
26
+
27
+ ---
28
+
29
+ ## Release!
30
+
31
+ - Push the commit to `master`
32
+ - Run `bin/rake release` to release the new version to Rubygems
21
33
  - 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
34
 
23
- ## Opal docs
35
+ ---
36
+
37
+ ## After the release
38
+
39
+ ### Opal docs
24
40
 
25
41
  - Open `opal-docs` and run `bin/build v1.2.3`
26
42
  - Then run `bin/deploy`
27
43
 
28
- ## [skip for pre-releases] Opal site
44
+ ### [skip for pre-releases] Opal site
29
45
 
30
46
  - Open `opal.github.io` and update the opal version in the `Gemfile`
31
47
  - run `bin/build`
32
48
  - `git push` the latest changes
33
49
 
34
- ## Opal CDN
50
+ ### Opal CDN
35
51
 
36
52
  - Run `bin/release v1.2.3`
37
53
 
38
- ## [skip for minor-releases] Prepare for the next release
54
+ ### [skip for minor-releases] Prepare for the next release
39
55
 
40
56
  - Create a new pull request that:
41
57
  - Updates a version to `v1.x.0.dev` in both `lib/opal/version.rb` and `opal/corelib/constants.rb`
@@ -252,8 +252,9 @@ module Opal
252
252
 
253
253
  awaiting = 0
254
254
  built = 0
255
+ should_log = $stderr.tty? && !ENV['OPAL_DISABLE_PREFORK_LOGS']
255
256
 
256
- $stderr.print "\r\e[K" if $stderr.tty?
257
+ $stderr.print "\r\e[K" if should_log
257
258
 
258
259
  loop do
259
260
  events, idles = @forks.get_events(queue.length)
@@ -296,7 +297,7 @@ module Opal
296
297
  end
297
298
  end
298
299
 
299
- if $stderr.tty?
300
+ if should_log
300
301
  percent = (100.0 * built / (awaiting + built)).round(1)
301
302
  str = format("[opal/builder] Building %<first>s... (%<percent>4.3g%%)\r", first: first, percent: percent)
302
303
  $stderr.print str
@@ -307,7 +308,7 @@ module Opal
307
308
 
308
309
  processed
309
310
  ensure
310
- $stderr.print "\r\e[K\r" if $stderr.tty?
311
+ $stderr.print "\r\e[K\r" if should_log
311
312
  @forks.close
312
313
  @forks.wait
313
314
  end
data/lib/opal/cli.rb CHANGED
@@ -169,10 +169,11 @@ module Opal
169
169
 
170
170
  compiler.compile
171
171
 
172
- result = compiler.result
173
- source_map = compiler.source_map.to_json
174
-
175
- b64 = [result, source_map, contents].map { |i| Base64.strict_encode64(i) }.join(',')
172
+ b64 = [
173
+ compiler.result,
174
+ compiler.source_map.to_json,
175
+ evals_or_file_source,
176
+ ].map { |i| Base64.strict_encode64(i) }.join(',')
176
177
 
177
178
  output.puts "https://sokra.github.io/source-map-visualization/#base64,#{b64}"
178
179
  end
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.7.1'
6
+ VERSION = '1.7.2'
7
7
  end
@@ -1,9 +1,9 @@
1
1
  ::RUBY_PLATFORM = 'opal'
2
2
  ::RUBY_ENGINE = 'opal'
3
3
  ::RUBY_VERSION = '3.2.0'
4
- ::RUBY_ENGINE_VERSION = '1.7.1'
5
- ::RUBY_RELEASE_DATE = '2023-01-06'
4
+ ::RUBY_ENGINE_VERSION = '1.7.2'
5
+ ::RUBY_RELEASE_DATE = '2023-01-20'
6
6
  ::RUBY_PATCHLEVEL = 0
7
7
  ::RUBY_REVISION = '0'
8
- ::RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2022 Adam Beynon and the Opal contributors'
8
+ ::RUBY_COPYRIGHT = 'opal - Copyright (C) 2011-2023 Adam Beynon and the Opal contributors'
9
9
  ::RUBY_DESCRIPTION = "opal #{::RUBY_ENGINE_VERSION} (#{::RUBY_RELEASE_DATE} revision #{::RUBY_REVISION})"
data/spec/lib/cli_spec.rb CHANGED
@@ -248,6 +248,16 @@ RSpec.describe Opal::CLI do
248
248
  end
249
249
  end
250
250
 
251
+ describe ':debug_source_map' do
252
+ let(:options) { { debug_source_map: true, evals: ['puts 123'] } }
253
+
254
+ it 'generates a link to https://sokra.github.io/source-map-visualization' do
255
+ expect_output_of { subject.run }.to start_with(
256
+ "https://sokra.github.io/source-map-visualization/#base64,"
257
+ )
258
+ end
259
+ end
260
+
251
261
  context 'using pipes' do
252
262
  it 'runs the provided source' do
253
263
  # `echo` on windows will output double-quotes along with the contents, that's why we print with ruby
@@ -16,7 +16,7 @@ RSpec.describe "rake dist" do
16
16
 
17
17
  stdout, _, status = Open3.capture3('node', '-e', code)
18
18
 
19
- expect(status).to eq(0)
19
+ expect(status.exitstatus).to eq(0)
20
20
 
21
21
  stdout.chomp
22
22
  end
@@ -7,6 +7,8 @@ end
7
7
 
8
8
  require 'opal'
9
9
 
10
+ ENV['OPAL_DISABLE_PREFORK_LOGS'] = '1'
11
+
10
12
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
11
13
  RSpec.configure do |config|
12
14
  config.before { Opal.reset_paths! unless RUBY_PLATFORM == 'opal' }
data/tasks/releasing.rake CHANGED
@@ -80,3 +80,49 @@ task :changelog do
80
80
 
81
81
  File.write changelog_path, changelog_entries.join("\n\n\n\n\n")
82
82
  end
83
+
84
+ namespace :release do
85
+ task :prepare do
86
+ version = ENV['VERSION'] or abort "please provide a version as the first argument, e.g.: #{$0} 1.2.3"
87
+ version = version[1..] if version.start_with? 'v'
88
+ gem_version = Gem::Version.new(version)
89
+
90
+ version_path = "#{__dir__}/../lib/opal/version.rb"
91
+ puts "== update #{version_path}"
92
+ require_relative version_path
93
+ File.write version_path, File.read(version_path).sub(Opal::VERSION, version)
94
+
95
+ constants_path = "#{__dir__}/../opal/corelib/constants.rb"
96
+ puts "== update #{constants_path}"
97
+ require_relative constants_path
98
+ File.write constants_path, File.read(constants_path).sub(Opal::VERSION, version).sub(
99
+ %r{(RUBY_RELEASE_DATE *= *')\d{4}-\d{2}-\d{2}(')},
100
+ '\1' + Time.now.strftime('%F') + '\2'
101
+ )
102
+
103
+ if gem_version.prerelease?
104
+ puts "== (skipping changlog update)"
105
+ else
106
+ puts "== update changelog"
107
+
108
+ system "bin/rake changelog VERSION=v#{version}" or abort('changelog update failed')
109
+ File.write "#{__dir__}/../UNRELEASED.md", <<~MARKDOWN
110
+ <!--
111
+ ### Internal
112
+ ### Changed
113
+ ### Added
114
+ ### Removed
115
+ ### Deprecated
116
+ ### Performance
117
+ ### Fixed
118
+ -->
119
+
120
+ MARKDOWN
121
+ end
122
+
123
+ puts "== committing"
124
+ sh 'git add UNRELEASED.md CHANGELOG.md opal/corelib/constants.rb lib/opal/version.rb'
125
+ sh "git commit -m 'Release v#{version}'"
126
+ sh 'git show | cat'
127
+ end
128
+ end
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.7.1
4
+ version: 1.7.2
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: 2023-01-05 00:00:00.000000000 Z
13
+ date: 2023-01-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ast
@@ -1215,10 +1215,10 @@ licenses:
1215
1215
  metadata:
1216
1216
  homepage_uri: https://opalrb.com/
1217
1217
  bug_tracker_uri: https://github.com/opal/opal/issues
1218
- changelog_uri: https://github.com/opal/opal/blob/v1.7.1/CHANGELOG.md
1219
- readme_uri: https://github.com/opal/opal/blob/v1.7.1/README.md
1220
- api_documentation_uri: http://opalrb.com/docs/api/v1.7.1/index.html
1221
- guides_uri: http://opalrb.com/docs/guides/v1.7.1/index.html
1218
+ changelog_uri: https://github.com/opal/opal/blob/v1.7.2/CHANGELOG.md
1219
+ readme_uri: https://github.com/opal/opal/blob/v1.7.2/README.md
1220
+ api_documentation_uri: http://opalrb.com/docs/api/v1.7.2/index.html
1221
+ guides_uri: http://opalrb.com/docs/guides/v1.7.2/index.html
1222
1222
  chat_uri: https://gitter.im/opal/opal
1223
1223
  source_code_uri: https://github.com/opal/opal
1224
1224
  post_install_message:
@@ -1236,7 +1236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1236
1236
  - !ruby/object:Gem::Version
1237
1237
  version: '0'
1238
1238
  requirements: []
1239
- rubygems_version: 3.3.26
1239
+ rubygems_version: 3.4.3
1240
1240
  signing_key:
1241
1241
  specification_version: 4
1242
1242
  summary: Ruby runtime and core library for JavaScript