ruby2js 2.1.9 → 2.1.10

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
  SHA1:
3
- metadata.gz: bcfebf8a01ec762ebf625014b80727dafb2e22a8
4
- data.tar.gz: 53775267829213753c29c2ec6927e2ab9f89d917
3
+ metadata.gz: 5ce20d44e74884ee6398867509b8857afe6637c0
4
+ data.tar.gz: b747496f4be90b29eb5d0f53847687e699350540
5
5
  SHA512:
6
- metadata.gz: 59b5bc183dec990415f7dc5cdc6592ebc288408ffaf97d8e370a207b589bf224ca5583091220338143c0501a362caaee39e70ece0444a37fb1789ea2fc1ff5ef
7
- data.tar.gz: 1fcaa9f1f1f15663eeaa3bb2f35cdd9910862415646dc70938f0ccbbebebd7e8402901a7356426a0b68c48c16de24738067a9969729b21c025db094099dd0f3c
6
+ metadata.gz: c421c508524c62b8edb36a605b3d9fdb91645a20298ce4451f90f69d00cfa1acd9eb4300c515d2b8d50973eb26fbb13e0980ec2bfc611d32d0badb025e48dcc4
7
+ data.tar.gz: 0642a682af8b19be72b772c78702e709ae3d7a4b83a5a67913b967852833be89c39bdda61497cd9f7b727006e63cca6ce428544ea5e9bfbe58a62512296166d8
data/lib/ruby2js.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  begin
2
2
  # silence warnings, see
3
+ # https://github.com/whitequark/parser/issues/346#issuecomment-317617695
3
4
  # https://github.com/bbatsov/rubocop/issues/1819#issuecomment-95280926
4
5
  old_verbose, $VERBOSE = $VERBOSE, nil
5
6
  require 'parser/current'
@@ -127,8 +127,13 @@ module Ruby2JS
127
127
  block = s(:begin, block) unless block and block.type == :begin
128
128
 
129
129
  if
130
- block.children.length != 1 or not block.children.last or
131
- not [:send, :block].include? block.children.first.type
130
+ (block.children.length != 1 and
131
+ not vue_wunderbar_free(block.children[0..-2])) or
132
+
133
+ not block.children.last or
134
+
135
+ (block.children.length == 1 and
136
+ not [:send, :block].include? block.children.first.type)
132
137
  then
133
138
  # wrap multi-line blocks with a 'span' element
134
139
  block = s(:return,
@@ -529,6 +534,7 @@ module Ruby2JS
529
534
 
530
535
  if value and value.type == :ivar
531
536
  hash[:domProps]['value'] ||= value
537
+ hash[:domProps]['textContent'] ||= value if tag == 'textarea'
532
538
  hash[:attrs].delete('value')
533
539
 
534
540
  # disable control until script is ready
@@ -681,7 +687,7 @@ module Ruby2JS
681
687
  end
682
688
 
683
689
  elsif
684
- VUE_METHODS.include? node.children[1] and
690
+ @vue_self and VUE_METHODS.include? node.children[1] and
685
691
  node.children[0] == s(:const, nil, :Vue)
686
692
  then
687
693
  # vm methods
@@ -904,6 +910,30 @@ module Ruby2JS
904
910
  process(node.children[1]))
905
911
  end
906
912
 
913
+ # ensure that there are no "wunderbar" or "createElement" calls in
914
+ # a set of statements.
915
+ def vue_wunderbar_free(nodes)
916
+ nodes.each do |node|
917
+ if Parser::AST::Node === node
918
+ if node.type == :send
919
+ # wunderbar style calls
920
+ return false if node.children[0] == nil and
921
+ node.children[1].to_s.start_with? '_'
922
+
923
+ # Vue.createElement calls
924
+ return false if node.children[0] == s(:const, nil, :Vue) and
925
+ node.children[1] == :createElement
926
+ end
927
+
928
+ # recurse
929
+ return false unless vue_wunderbar_free(node.children)
930
+ end
931
+ end
932
+
933
+ # no problems found
934
+ return true
935
+ end
936
+
907
937
  # gather ivar and cvar usage
908
938
  def vue_walk(node, inventory = Hash.new {|h, k| h[k] = []})
909
939
  # extract ivars and cvars
@@ -2,7 +2,7 @@ module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- TINY = 9
5
+ TINY = 10
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/ruby2js.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ruby2js 2.1.9 ruby lib
2
+ # stub: ruby2js 2.1.10 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ruby2js".freeze
6
- s.version = "2.1.9"
6
+ s.version = "2.1.10"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Sam Ruby".freeze]
11
- s.date = "2017-09-17"
11
+ s.date = "2017-09-19"
12
12
  s.description = " The base package maps Ruby syntax to JavaScript semantics.\n Filters may be provided to add Ruby-specific or framework specific\n behavior.\n".freeze
13
13
  s.email = "rubys@intertwingly.net".freeze
14
14
  s.files = ["README.md".freeze, "lib/ruby2js".freeze, "lib/ruby2js.rb".freeze, "lib/ruby2js/cgi.rb".freeze, "lib/ruby2js/converter".freeze, "lib/ruby2js/converter.rb".freeze, "lib/ruby2js/converter/arg.rb".freeze, "lib/ruby2js/converter/args.rb".freeze, "lib/ruby2js/converter/array.rb".freeze, "lib/ruby2js/converter/begin.rb".freeze, "lib/ruby2js/converter/block.rb".freeze, "lib/ruby2js/converter/blockpass.rb".freeze, "lib/ruby2js/converter/boolean.rb".freeze, "lib/ruby2js/converter/break.rb".freeze, "lib/ruby2js/converter/case.rb".freeze, "lib/ruby2js/converter/casgn.rb".freeze, "lib/ruby2js/converter/class.rb".freeze, "lib/ruby2js/converter/const.rb".freeze, "lib/ruby2js/converter/cvar.rb".freeze, "lib/ruby2js/converter/cvasgn.rb".freeze, "lib/ruby2js/converter/def.rb".freeze, "lib/ruby2js/converter/defined.rb".freeze, "lib/ruby2js/converter/defs.rb".freeze, "lib/ruby2js/converter/dstr.rb".freeze, "lib/ruby2js/converter/for.rb".freeze, "lib/ruby2js/converter/hash.rb".freeze, "lib/ruby2js/converter/if.rb".freeze, "lib/ruby2js/converter/in.rb".freeze, "lib/ruby2js/converter/ivar.rb".freeze, "lib/ruby2js/converter/ivasgn.rb".freeze, "lib/ruby2js/converter/kwbegin.rb".freeze, "lib/ruby2js/converter/literal.rb".freeze, "lib/ruby2js/converter/logical.rb".freeze, "lib/ruby2js/converter/masgn.rb".freeze, "lib/ruby2js/converter/module.rb".freeze, "lib/ruby2js/converter/next.rb".freeze, "lib/ruby2js/converter/nil.rb".freeze, "lib/ruby2js/converter/nthref.rb".freeze, "lib/ruby2js/converter/opasgn.rb".freeze, "lib/ruby2js/converter/prototype.rb".freeze, "lib/ruby2js/converter/regexp.rb".freeze, "lib/ruby2js/converter/return.rb".freeze, "lib/ruby2js/converter/self.rb".freeze, "lib/ruby2js/converter/send.rb".freeze, "lib/ruby2js/converter/super.rb".freeze, "lib/ruby2js/converter/sym.rb".freeze, "lib/ruby2js/converter/undef.rb".freeze, "lib/ruby2js/converter/until.rb".freeze, "lib/ruby2js/converter/untilpost.rb".freeze, "lib/ruby2js/converter/var.rb".freeze, "lib/ruby2js/converter/vasgn.rb".freeze, "lib/ruby2js/converter/while.rb".freeze, "lib/ruby2js/converter/whilepost.rb".freeze, "lib/ruby2js/converter/xstr.rb".freeze, "lib/ruby2js/execjs.rb".freeze, "lib/ruby2js/filter".freeze, "lib/ruby2js/filter/angular-resource.rb".freeze, "lib/ruby2js/filter/angular-route.rb".freeze, "lib/ruby2js/filter/angularrb.rb".freeze, "lib/ruby2js/filter/camelCase.rb".freeze, "lib/ruby2js/filter/functions.rb".freeze, "lib/ruby2js/filter/jquery.rb".freeze, "lib/ruby2js/filter/minitest-jasmine.rb".freeze, "lib/ruby2js/filter/react.rb".freeze, "lib/ruby2js/filter/require.rb".freeze, "lib/ruby2js/filter/return.rb".freeze, "lib/ruby2js/filter/rubyjs.rb".freeze, "lib/ruby2js/filter/strict.rb".freeze, "lib/ruby2js/filter/underscore.rb".freeze, "lib/ruby2js/filter/vue.rb".freeze, "lib/ruby2js/rails.rb".freeze, "lib/ruby2js/serializer.rb".freeze, "lib/ruby2js/sinatra.rb".freeze, "lib/ruby2js/version.rb".freeze, "ruby2js.gemspec".freeze]
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: 2.1.9
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-17 00:00:00.000000000 Z
11
+ date: 2017-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser