custom_elements_manifest_parser 0.2.7 → 0.2.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3375b5793a6c86dd8198d5e076f0f662f316dc4eeac2561df8e8c928d7d3622f
4
- data.tar.gz: 308443a2654e52b9a14da6f82fe73439fc9c23537dd0d93d5d928b2a1db11b38
3
+ metadata.gz: a001a44dccd2121534449c7bf8b1f3aaa8f21f2254ff384f66ae4fbd23e5274d
4
+ data.tar.gz: b5a909ac1b9dfa1839ca381f76e43f56eb633e7bcc417317044c836825ef5f88
5
5
  SHA512:
6
- metadata.gz: 61de78888fbe811281bc0157b626ff6d92e2802902f88e99614a7e26bbe3139ebdd06f1b770807de06d25a5ffab96f2b38978369088e6038699e37dceeea35ce
7
- data.tar.gz: 19d9edef8decd36d8511dcfbf31c7403553dd0f59c9023ecadaa51d954f69af6bb0e6c33bef5a8d229e2047d2ffbff14530e826e0faed6a87492db2b6fee0a02
6
+ metadata.gz: 440c1f987a729a4af2cd776ce324fc2067b397635bded843ed43286d54df62007f5fc8737365d104a116c469ab4cad03dde92b4b2ef15351398ba41f2697034c
7
+ data.tar.gz: bb6277a2c4e7539410b3a741710d40d3a66800d6853520b11dcf3d9359bed048bf311c9ac5421094ccf1081bc015f58632300122b6819436e5d75ae82f6b3f8c
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ -m markdown
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
@@ -8,3 +8,7 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
  gem "yard"
10
10
  gem "minitest", "~> 5.0"
11
+
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.7)
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,7 +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)
14
+ backports (3.24.1)
15
+ benchmark (0.2.1)
12
16
  concurrent-ruby (1.2.2)
17
+ diff-lcs (1.5.0)
13
18
  dry-configurable (1.1.0)
14
19
  dry-core (~> 1.0, < 2)
15
20
  zeitwerk (~> 2.6)
@@ -47,10 +52,68 @@ GEM
47
52
  dry-initializer (~> 3.0)
48
53
  dry-schema (>= 1.12, < 2)
49
54
  zeitwerk (~> 2.6)
55
+ e2mmap (0.1.0)
50
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)
51
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)
72
+ rainbow (3.1.1)
52
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)
53
112
  yard (0.9.34)
113
+ yard-junk (0.0.9)
114
+ backports (>= 3.18)
115
+ rainbow
116
+ yard
54
117
  zeitwerk (2.6.12)
55
118
 
56
119
  PLATFORMS
@@ -60,7 +123,9 @@ DEPENDENCIES
60
123
  custom_elements_manifest_parser!
61
124
  minitest (~> 5.0)
62
125
  rake (~> 13.0)
126
+ solargraph (~> 0.49.0)
63
127
  yard
128
+ yard-junk (~> 0.0.9)
64
129
 
65
130
  BUNDLED WITH
66
131
  2.2.33
data/README.md CHANGED
@@ -240,7 +240,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
240
240
 
241
241
  ## Contributing
242
242
 
243
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/custom_elements_manifest_parser. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/custom_elements_manifest_parser/blob/main/CODE_OF_CONDUCT.md).
243
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/custom_elements_manifest_parser. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/konnorrogers/custom_elements_manifest_parser/blob/main/CODE_OF_CONDUCT.md).
244
244
 
245
245
  ## License
246
246
 
@@ -248,4 +248,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
248
248
 
249
249
  ## Code of Conduct
250
250
 
251
- Everyone interacting in the CustomElementsManifestParser project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/custom_elements_manifest_parser/blob/main/CODE_OF_CONDUCT.md).
251
+ Everyone interacting in the CustomElementsManifestParser project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/konnorrogers/custom_elements_manifest_parser/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -21,3 +21,7 @@ YARD::Rake::YardocTask.new do |t|
21
21
  end
22
22
 
23
23
  task default: :test
24
+
25
+ require 'yard-junk/rake'
26
+ # rake yard:junk
27
+ YardJunk::Rake.define_task
@@ -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.7"
4
+ VERSION = "0.2.9"
5
5
  end
@@ -4,11 +4,8 @@
4
4
  # @!parse
5
5
  Dir["#{__dir__}/custom_elements_manifest_parser/**/*.rb"].each { |file| require file }
6
6
 
7
-
8
- #
9
7
  # Top level parser
10
8
  module CustomElementsManifestParser
11
- autoload :Parser, "custom_elements_manifest_parser/parser"
12
9
  # Shortuct for `CustomElementsManifestParser::Parser.new().parse()`
13
10
  # @return [CustomElementsManifestParser::Parser]
14
11
  def self.parse(hash)
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.7
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-30 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
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".yardopts"
62
63
  - CHANGELOG.md
63
64
  - CODE_OF_CONDUCT.md
64
65
  - Gemfile
@@ -84,6 +85,7 @@ files:
84
85
  - lib/custom_elements_manifest_parser/data_types/source_reference.rb
85
86
  - lib/custom_elements_manifest_parser/data_types/type.rb
86
87
  - lib/custom_elements_manifest_parser/data_types/type_reference.rb
88
+ - lib/custom_elements_manifest_parser/mixins/has_parent_module.rb
87
89
  - lib/custom_elements_manifest_parser/nodes/class_declaration.rb
88
90
  - lib/custom_elements_manifest_parser/nodes/class_field.rb
89
91
  - lib/custom_elements_manifest_parser/nodes/class_method.rb