ruby2js 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/ruby2js/converter/block.rb +5 -0
- data/lib/ruby2js/serializer.rb +1 -1
- data/lib/ruby2js/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cdffdc5d823c8e1c36abf924de9f8a489508a5c472b5ac0dd11c42f14dfa7e1
|
4
|
+
data.tar.gz: bfa2a41e9865fef31f7502ab1027f5486103434050aec92d3fe4d6044d165d52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce19f04471f515a27d5cd13fb8beea734fb88246efe03a7ac746e29b07a96696afc5751de9d5f73f0d81d761de7bd8d853197e7d0ce7ce68eab0796524f2b222
|
7
|
+
data.tar.gz: 70080cf83c65cfe8d8c6aaa6067ae191df714dfe838977e5be50902624f4e516a680ee0459fcdd8d7274834e29841df5ec592e6ee31dfe990dea305f457c1707
|
data/README.md
CHANGED
@@ -622,6 +622,14 @@ conversions are made by the `functions` filter:
|
|
622
622
|
* `.entries()` becomes `Object.entries()`
|
623
623
|
* `.each_pair {}` becomes `for (let [key, value] of Object.entries()) {}'
|
624
624
|
|
625
|
+
async support:
|
626
|
+
|
627
|
+
* `async def` becomes `async function`
|
628
|
+
* `async lambda` becomes `async =>`
|
629
|
+
* `async proc` becomes `async =>`
|
630
|
+
* `async ->` becomes `async =>`
|
631
|
+
* `foo bar, async do...end` becomes `foo(bar, async () => {})`
|
632
|
+
|
625
633
|
ES2018 support
|
626
634
|
---
|
627
635
|
|
@@ -9,6 +9,11 @@ module Ruby2JS
|
|
9
9
|
|
10
10
|
handle :block do |call, args, block|
|
11
11
|
|
12
|
+
if es2017 and call.children.last == s(:send, nil, :async)
|
13
|
+
return parse call.updated(nil, [*call.children[0..-2],
|
14
|
+
s(:send, nil, :async, s(:block, s(:send, nil, :proc), args, block))])
|
15
|
+
end
|
16
|
+
|
12
17
|
if \
|
13
18
|
@state == :statement and args.children.length == 1 and
|
14
19
|
call.children.first and call.children.first.type == :begin and
|
data/lib/ruby2js/serializer.rb
CHANGED
@@ -355,7 +355,7 @@ module Ruby2JS
|
|
355
355
|
end
|
356
356
|
|
357
357
|
split = buffer.source[0...pos].split("\n")
|
358
|
-
vlq row, col, source_index, split.length-1, split.last.to_s.length
|
358
|
+
vlq row, col, source_index, [split.length - 1, 0].max, split.last.to_s.length
|
359
359
|
end
|
360
360
|
col += token.length
|
361
361
|
end
|
data/lib/ruby2js/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby2js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|