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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95f417ee4f6e6c9089df85ffb552743254b8ce925fff838f43534a393bfdc5d2
4
- data.tar.gz: 055757cb6d70b74694b4ba832da05214a4109538d2ff9dbd8e44d4f8ba559079
3
+ metadata.gz: ad0a82c0ecf5706196abd426721fcf57a7b9ce47a29beed5210799c6f3f0ebb2
4
+ data.tar.gz: f0175660cc2d670698e85cd8d0b17ee0cde96e601dfcf53d40dfc87fb09a958d
5
5
  SHA512:
6
- metadata.gz: 3a84df0108a0ba76605adcf72f8fd0d1fc71ab7ffa1811227101974dd59a20efd4381ee8cdcd20cffc72f2ca2712f94f5692b94e5f221ece6a10f7c64a162050
7
- data.tar.gz: b21f95b69e040276fbee5bc0f829fb1536541c0877229ed78c067f79f2f6e08328c5d808caf3f1e5ae9d9f51a8ada7ba97e54a0420f0492fbaeb8815d9d71e63
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.2.0)
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.3)
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
- name = "$" + name if m.value.accessor == "alias"
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
- #$stdout.puts removed.inspect
91
+ # $stdout.puts removed.inspect
85
92
  reload
86
93
  break if removed.length == 0
87
94
  end
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  class Optimizer
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -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
- end.group_by { |i| i.value.accessor }
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.3
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-07-31 00:00:00.000000000 Z
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.15
88
+ rubygems_version: 3.2.22
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Optimize Opal's resulting javascript code