ruby2js 3.5.0 → 3.5.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 +4 -4
- data/README.md +6 -0
- data/lib/ruby2js/converter.rb +5 -3
- data/lib/ruby2js/converter/ivar.rb +10 -2
- data/lib/ruby2js/filter/fast-deep-equal.rb +23 -0
- data/lib/ruby2js/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f659d6312b558d08a3ca6c1f30183d602445ed580910715909ea2b4334a114a9
|
4
|
+
data.tar.gz: 3f07730f5727ea25b95e095c7b45c19f3fb85dcc5d640e822a3a629fa88b8056
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a85a3d7f144485575608cd136d764e36868d095fb8dbf4f6bc8b8adb8a218379775eeb12934c148574cac0f03dc6e12fc6223ef302973b5f4cb0a0629ba41de4
|
7
|
+
data.tar.gz: 4c154cd393ce76cc0f72e23180fbfdd1b0b8e876a5d60686d246e9f53effff1c4f4ce4ea3c5573cf9ac5cb7cfcda3d2300ee865c2d8d21855a717fa8f203de4a
|
data/README.md
CHANGED
data/lib/ruby2js/converter.rb
CHANGED
@@ -3,9 +3,11 @@ require 'ruby2js/serializer'
|
|
3
3
|
module Ruby2JS
|
4
4
|
class Error < NotImplementedError
|
5
5
|
def initialize(message, ast)
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
if ast.loc
|
7
|
+
message += ' at ' + ast.loc.expression.source_buffer.name.to_s
|
8
|
+
message += ':' + ast.loc.expression.line.inspect
|
9
|
+
message += ':' + ast.loc.expression.column.to_s
|
10
|
+
end
|
9
11
|
super(message)
|
10
12
|
end
|
11
13
|
end
|
@@ -16,8 +16,16 @@ module Ruby2JS
|
|
16
16
|
handle :hostvalue do |value|
|
17
17
|
case value
|
18
18
|
when Hash
|
19
|
-
parse s(:hash, *value.map {|key, hvalue|
|
20
|
-
|
19
|
+
parse s(:hash, *value.map {|key, hvalue|
|
20
|
+
case key
|
21
|
+
when String
|
22
|
+
s(:pair, s(:str, key), s(:hostvalue, hvalue))
|
23
|
+
when Symbol
|
24
|
+
s(:pair, s(:sym, key), s(:hostvalue, hvalue))
|
25
|
+
else
|
26
|
+
s(:pair, s(:hostvalue, key), s(:hostvalue, hvalue))
|
27
|
+
end
|
28
|
+
})
|
21
29
|
when Array
|
22
30
|
parse s(:array, *value.map {|hvalue| s(:hostvalue, hvalue)})
|
23
31
|
when String
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'ruby2js'
|
2
|
+
|
3
|
+
module Ruby2JS
|
4
|
+
module Filter
|
5
|
+
module Fast_Deep_Equal
|
6
|
+
include SEXP
|
7
|
+
|
8
|
+
SCALAR = [ :float, :int, :nil, :str ]
|
9
|
+
|
10
|
+
def on_send(node)
|
11
|
+
return super unless node.children.length == 3
|
12
|
+
left, method, right = node.children
|
13
|
+
return super unless method == :==
|
14
|
+
return super if SCALAR.include? left.type
|
15
|
+
return super if SCALAR.include? right.type
|
16
|
+
|
17
|
+
node.updated nil, [nil, :$eq, left, right]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
DEFAULTS.push Fast_Deep_Equal
|
22
|
+
end
|
23
|
+
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.5.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/ruby2js/filter/cjs.rb
|
126
126
|
- lib/ruby2js/filter/esm.rb
|
127
127
|
- lib/ruby2js/filter/esm_migration.rb
|
128
|
+
- lib/ruby2js/filter/fast-deep-equal.rb
|
128
129
|
- lib/ruby2js/filter/functions.rb
|
129
130
|
- lib/ruby2js/filter/jquery.rb
|
130
131
|
- lib/ruby2js/filter/matchAll.rb
|
@@ -149,7 +150,7 @@ homepage: http://github.com/rubys/ruby2js
|
|
149
150
|
licenses:
|
150
151
|
- MIT
|
151
152
|
metadata: {}
|
152
|
-
post_install_message:
|
153
|
+
post_install_message:
|
153
154
|
rdoc_options: []
|
154
155
|
require_paths:
|
155
156
|
- lib
|
@@ -164,8 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
165
|
- !ruby/object:Gem::Version
|
165
166
|
version: '0'
|
166
167
|
requirements: []
|
167
|
-
rubygems_version: 3.2
|
168
|
-
signing_key:
|
168
|
+
rubygems_version: 3.1.2
|
169
|
+
signing_key:
|
169
170
|
specification_version: 4
|
170
171
|
summary: Minimal yet extensible Ruby to JavaScript conversion.
|
171
172
|
test_files: []
|