custom_elements_manifest_parser 0.2.8 → 0.2.9

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: 5941c0ae977e0440541172e05578281a00b6f0f6efbef48a157ead4df426ce73
4
- data.tar.gz: 2f5963abf861c2d16db39ef4ee9b463ab7065a45ab89905f1000143084c24806
3
+ metadata.gz: a001a44dccd2121534449c7bf8b1f3aaa8f21f2254ff384f66ae4fbd23e5274d
4
+ data.tar.gz: b5a909ac1b9dfa1839ca381f76e43f56eb633e7bcc417317044c836825ef5f88
5
5
  SHA512:
6
- metadata.gz: 4847ce0fbe7850f8e65c9a4ac526f3b6e594ddf755a0ce13762addf89d2916e006b9d57013f3f064a344abcf467a1f5bc164035fb1ba218e0961042e5743f2b7
7
- data.tar.gz: 13c3ddbfb1dab53158571506936842ece1dcf353c98020f66c471dc4caf2a28f8a05d2b93710bf167f5a42fcf8908b7d46bdc5464f2c930ec69c6b702feb491f
6
+ metadata.gz: 440c1f987a729a4af2cd776ce324fc2067b397635bded843ed43286d54df62007f5fc8737365d104a116c469ab4cad03dde92b4b2ef15351398ba41f2697034c
7
+ data.tar.gz: bb6277a2c4e7539410b3a741710d40d3a66800d6853520b11dcf3d9359bed048bf311c9ac5421094ccf1081bc015f58632300122b6819436e5d75ae82f6b3f8c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Unreleased
2
2
 
3
+ ## [0.2.9] - 11/01/2023
4
+
5
+ - Fixed a bug where `parent_module` was not serializing `exports` or `children`
6
+
3
7
  ## [0.2.3] - 10/08/2023
4
8
 
5
9
  - Fixed a bug where `ClassLikeStruct` was not getting properly serialized.
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ gem "yard"
10
10
  gem "minitest", "~> 5.0"
11
11
 
12
12
  gem "yard-junk", "~> 0.0.9"
13
+
14
+ gem "solargraph", "~> 0.49.0", :group => :development
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- custom_elements_manifest_parser (0.2.8)
4
+ custom_elements_manifest_parser (0.2.9)
5
5
  dry-struct (~> 1.0)
6
6
  dry-types (~> 1.0)
7
7
  dry-validation (~> 1.0)
@@ -9,8 +9,12 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
+ ast (2.4.2)
13
+ backport (1.2.0)
12
14
  backports (3.24.1)
15
+ benchmark (0.2.1)
13
16
  concurrent-ruby (1.2.2)
17
+ diff-lcs (1.5.0)
14
18
  dry-configurable (1.1.0)
15
19
  dry-core (~> 1.0, < 2)
16
20
  zeitwerk (~> 2.6)
@@ -48,10 +52,63 @@ GEM
48
52
  dry-initializer (~> 3.0)
49
53
  dry-schema (>= 1.12, < 2)
50
54
  zeitwerk (~> 2.6)
55
+ e2mmap (0.1.0)
51
56
  ice_nine (0.11.2)
57
+ jaro_winkler (1.5.6)
58
+ json (2.6.3)
59
+ kramdown (2.4.0)
60
+ rexml
61
+ kramdown-parser-gfm (1.1.0)
62
+ kramdown (~> 2.0)
63
+ language_server-protocol (3.17.0.3)
52
64
  minitest (5.20.0)
65
+ nokogiri (1.15.4-arm64-darwin)
66
+ racc (~> 1.4)
67
+ parallel (1.23.0)
68
+ parser (3.2.2.4)
69
+ ast (~> 2.4.1)
70
+ racc
71
+ racc (1.7.1)
53
72
  rainbow (3.1.1)
54
73
  rake (13.0.6)
74
+ rbs (2.8.4)
75
+ regexp_parser (2.8.2)
76
+ reverse_markdown (2.1.1)
77
+ nokogiri
78
+ rexml (3.2.6)
79
+ rubocop (1.57.2)
80
+ json (~> 2.3)
81
+ language_server-protocol (>= 3.17.0)
82
+ parallel (~> 1.10)
83
+ parser (>= 3.2.2.4)
84
+ rainbow (>= 2.2.2, < 4.0)
85
+ regexp_parser (>= 1.8, < 3.0)
86
+ rexml (>= 3.2.5, < 4.0)
87
+ rubocop-ast (>= 1.28.1, < 2.0)
88
+ ruby-progressbar (~> 1.7)
89
+ unicode-display_width (>= 2.4.0, < 3.0)
90
+ rubocop-ast (1.30.0)
91
+ parser (>= 3.2.1.0)
92
+ ruby-progressbar (1.13.0)
93
+ solargraph (0.49.0)
94
+ backport (~> 1.2)
95
+ benchmark
96
+ bundler (~> 2.0)
97
+ diff-lcs (~> 1.4)
98
+ e2mmap
99
+ jaro_winkler (~> 1.5)
100
+ kramdown (~> 2.3)
101
+ kramdown-parser-gfm (~> 1.1)
102
+ parser (~> 3.0)
103
+ rbs (~> 2.0)
104
+ reverse_markdown (~> 2.0)
105
+ rubocop (~> 1.38)
106
+ thor (~> 1.0)
107
+ tilt (~> 2.0)
108
+ yard (~> 0.9, >= 0.9.24)
109
+ thor (1.3.0)
110
+ tilt (2.3.0)
111
+ unicode-display_width (2.5.0)
55
112
  yard (0.9.34)
56
113
  yard-junk (0.0.9)
57
114
  backports (>= 3.18)
@@ -66,6 +123,7 @@ DEPENDENCIES
66
123
  custom_elements_manifest_parser!
67
124
  minitest (~> 5.0)
68
125
  rake (~> 13.0)
126
+ solargraph (~> 0.49.0)
69
127
  yard
70
128
  yard-junk (~> 0.0.9)
71
129
 
@@ -0,0 +1,12 @@
1
+ module CustomElementsManifestParser
2
+ module Mixins
3
+ # Any "DeclarableNodeStruct", has a "_parent_module"
4
+ module HasParentModule
5
+ def parent_module
6
+ return parser.visit_node(_parent_module) if parser
7
+
8
+ nil
9
+ end
10
+ end
11
+ end
12
+ end
@@ -11,6 +11,7 @@ module CustomElementsManifestParser
11
11
  # @return ["class"]
12
12
  def self.kind; 'class'; end
13
13
 
14
+ include Mixins::HasParentModule
14
15
 
15
16
  # @!parse include Structs::DeclarableNodeStruct
16
17
  attributes_from Structs::DeclarableNodeStruct
@@ -27,6 +27,8 @@ module CustomElementsManifestParser
27
27
  # @return [SourceReference, nil]
28
28
  attribute :source, Types::Nominal::Any.optional.meta(required: false)
29
29
 
30
+ include Mixins::HasParentModule
31
+
30
32
  # @!parse include Structs::DeclarableNodeStruct
31
33
  attributes_from Structs::DeclarableNodeStruct
32
34
 
@@ -8,6 +8,7 @@ module CustomElementsManifestParser
8
8
  module Nodes
9
9
  # Documents a method attached to a class
10
10
  class ClassMethod < BaseStruct
11
+ include Mixins::HasParentModule
11
12
 
12
13
  # @!parse Structs::FunctionLikeStruct
13
14
  attributes_from Structs::FunctionLikeStruct
@@ -20,6 +20,8 @@ module CustomElementsManifestParser
20
20
  # @return ["custom-element-definition"]
21
21
  attribute :kind, Types.Value("custom-element-definition")
22
22
 
23
+ include Mixins::HasParentModule
24
+
23
25
  # @!parse Structs::DeclarableNodeStruct
24
26
  attributes_from Structs::DeclarableNodeStruct
25
27
 
@@ -7,6 +7,8 @@ module CustomElementsManifestParser
7
7
  module Nodes
8
8
  # Documents a function
9
9
  class FunctionDeclaration < BaseStruct
10
+ include Mixins::HasParentModule
11
+
10
12
  # @!parse include Structs::DeclarableNodeStruct
11
13
  attributes_from Structs::DeclarableNodeStruct
12
14
 
@@ -7,6 +7,8 @@ module CustomElementsManifestParser
7
7
  module Nodes
8
8
  # A JavaScript export!
9
9
  class JavaScriptExport < BaseStruct
10
+ include Mixins::HasParentModule
11
+
10
12
  # @!parse include Structs::DeclarableNodeStruct
11
13
  attributes_from Structs::DeclarableNodeStruct
12
14
 
@@ -48,8 +48,8 @@ module CustomElementsManifestParser
48
48
 
49
49
  def visit(parser:)
50
50
  hash = {}
51
- hash[:declarations] = declarations.map { |declaration| parser.visit_node(declaration.merge(parent_module: self)) } unless declarations.nil?
52
- hash[:exports] = exports.map { |export| parser.visit_node(export.merge(parent_module: self)) } unless exports.nil?
51
+ hash[:declarations] = declarations.map { |declaration| parser.visit_node(declaration.merge(_parent_module: self, parser: parser)) } unless declarations.nil?
52
+ hash[:exports] = exports.map { |export| parser.visit_node(export.merge(_parent_module: self, parser: parser)) } unless exports.nil?
53
53
 
54
54
  new(hash)
55
55
  end
@@ -68,7 +68,9 @@ module CustomElementsManifestParser
68
68
  attribute attr.name, attr.type
69
69
  end
70
70
 
71
- # @!parse Structs::FunctionLikeStruct
71
+ include Mixins::HasParentModule
72
+
73
+ # @!parse Structs::DeclarableNodeStruct
72
74
  attributes_from Structs::DeclarableNodeStruct
73
75
 
74
76
  # @!attribute kind
@@ -8,6 +8,8 @@ module CustomElementsManifestParser
8
8
  module Nodes
9
9
  # Documents a variable
10
10
  class VariableDeclaration < BaseStruct
11
+ include Mixins::HasParentModule
12
+
11
13
  # @!parse include Structs::DeclarableNodeStruct
12
14
  attributes_from Structs::DeclarableNodeStruct
13
15
 
@@ -82,7 +82,7 @@ module CustomElementsManifestParser
82
82
  # end
83
83
 
84
84
  def visit_node(node)
85
- kind = node["kind"] || node[:kind]
85
+ kind = node[:kind] || node["kind"]
86
86
  @visitable_nodes[kind].new(node).visit(parser: self)
87
87
  end
88
88
 
@@ -9,7 +9,9 @@ module CustomElementsManifestParser
9
9
  # @return [JavaScriptModule, nil] -
10
10
  # A convenience helper so you don't need to manually traverse the manifest and always go top -> bottom.
11
11
  # By using this you can grab the "path" and "exports" of a custom element.
12
- attribute :parent_module, Types::Nominal::Any.optional.meta(required: false)
12
+ attribute :_parent_module, Types::Nominal::Any.optional.meta(required: false)
13
+
14
+ attribute :parser, Types::Nominal::Any.optional.meta(required: false)
13
15
 
14
16
  def self.build_hash(parser:, struct:)
15
17
  {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CustomElementsManifestParser
4
- VERSION = "0.2.8"
4
+ VERSION = "0.2.9"
5
5
  end
@@ -1,13 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Requires all files
4
- # Dir["#{__dir__}/custom_elements_manifest_parser/**/*.rb"].each { |file| require file }
5
-
6
- $LOAD_PATH.unshift __dir__
7
-
8
- require "#{__dir__}/custom_elements_manifest_parser/types.rb"
9
- require "#{__dir__}/custom_elements_manifest_parser/parser.rb"
10
- require "#{__dir__}/custom_elements_manifest_parser/version.rb"
4
+ # @!parse
5
+ Dir["#{__dir__}/custom_elements_manifest_parser/**/*.rb"].each { |file| require file }
11
6
 
12
7
  # Top level parser
13
8
  module CustomElementsManifestParser
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_elements_manifest_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - konnorrogers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-31 00:00:00.000000000 Z
11
+ date: 2023-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -85,6 +85,7 @@ files:
85
85
  - lib/custom_elements_manifest_parser/data_types/source_reference.rb
86
86
  - lib/custom_elements_manifest_parser/data_types/type.rb
87
87
  - lib/custom_elements_manifest_parser/data_types/type_reference.rb
88
+ - lib/custom_elements_manifest_parser/mixins/has_parent_module.rb
88
89
  - lib/custom_elements_manifest_parser/nodes/class_declaration.rb
89
90
  - lib/custom_elements_manifest_parser/nodes/class_field.rb
90
91
  - lib/custom_elements_manifest_parser/nodes/class_method.rb