opal-optimizer 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/opal/optimizer/step/tree_shaking.rb +9 -2
- data/lib/opal/optimizer/version.rb +1 -1
- data/lib/opal/optimizer.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad0a82c0ecf5706196abd426721fcf57a7b9ce47a29beed5210799c6f3f0ebb2
|
4
|
+
data.tar.gz: f0175660cc2d670698e85cd8d0b17ee0cde96e601dfcf53d40dfc87fb09a958d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83c6f036a54074918d249fb9f2a3ddbeb61c42ea017dc4b2694f81fdc7de6ab3b6968eeb04f48f09bd35553af30c3190d960ae2eccf12a2d3563a674ffd3e05a
|
7
|
+
data.tar.gz: 483ad9f4fe3e9d878c4565e912778f791732e9969f1dc8a2dcfdae22e3c7c75b5687591b96f15c5c74f84cf97ad162ee73604e3c87f5ab5dd3016ef8088c882a
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ PATH
|
|
8
8
|
PATH
|
9
9
|
remote: ../opal
|
10
10
|
specs:
|
11
|
-
opal (1.
|
11
|
+
opal (1.3.0.alpha1)
|
12
12
|
ast (>= 2.3.0)
|
13
13
|
parser (~> 3.0)
|
14
14
|
|
@@ -20,7 +20,7 @@ PATH
|
|
20
20
|
PATH
|
21
21
|
remote: .
|
22
22
|
specs:
|
23
|
-
opal-optimizer (0.1.
|
23
|
+
opal-optimizer (0.1.4)
|
24
24
|
opal (>= 1.0.0)
|
25
25
|
rkelly-turbo
|
26
26
|
|
@@ -55,10 +55,17 @@ class TreeShaking < Step
|
|
55
55
|
when AddNode
|
56
56
|
if StringNode === name.left && StringNode === name.value
|
57
57
|
name = name.left.value[1..-2] + name.value.value[1..-2]
|
58
|
+
else
|
59
|
+
next
|
58
60
|
end
|
59
61
|
when StringNode
|
60
62
|
name = name.value[1..-2]
|
61
|
-
|
63
|
+
case m.value
|
64
|
+
when ResolveNode
|
65
|
+
name = "$" + name if m.value.value == "$alias"
|
66
|
+
when DotAccessorNode
|
67
|
+
name = "$" + name if m.value.accessor == "alias"
|
68
|
+
end
|
62
69
|
else
|
63
70
|
next
|
64
71
|
end
|
@@ -81,7 +88,7 @@ class TreeShaking < Step
|
|
81
88
|
def run
|
82
89
|
loop do
|
83
90
|
removed = shake_methods
|
84
|
-
|
91
|
+
# $stdout.puts removed.inspect
|
85
92
|
reload
|
86
93
|
break if removed.length == 0
|
87
94
|
end
|
data/lib/opal/optimizer.rb
CHANGED
@@ -46,8 +46,9 @@ module Opal
|
|
46
46
|
def reload
|
47
47
|
@function_calls = ast.pointcut(FunctionCallNode).matches
|
48
48
|
@corelib_calls = @function_calls.select do |i|
|
49
|
-
i.value_path?(DotAccessorNode, ResolveNode, "Opal")
|
50
|
-
|
49
|
+
i.value_path?(DotAccessorNode, ResolveNode, "Opal") ||
|
50
|
+
i.value_path?(ResolveNode, /\A\$/)
|
51
|
+
end.group_by { |i| (i.value.value.is_a?(String) ? i.value.value : i.value.accessor).gsub('$', '') }
|
51
52
|
@corelib_calls = Hash.new { [] }.merge(@corelib_calls)
|
52
53
|
end
|
53
54
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-optimizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hmdne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rkelly-turbo
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.2.
|
88
|
+
rubygems_version: 3.2.22
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Optimize Opal's resulting javascript code
|