custom_elements_manifest_parser 0.2.0 → 0.2.2

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: 66c8bdbc69aa76da418725dd7a36f155378aa6af3e88a8d2743e519c2edea4f0
4
- data.tar.gz: 966d6a3b1678f7d8ab2135db6248fbd0cfa86f72ee0f0ad5971f4f61f5a56788
3
+ metadata.gz: 6beaf37f8491efe1595f5096382d7a4a5411ee45d20b7cc11dba837b01fcab16
4
+ data.tar.gz: e51611fe9a6d4e3a3367283659226d9b89721aadcc82276851b5835e4a42578b
5
5
  SHA512:
6
- metadata.gz: 8ff7c6e45d310418da1a780b2ba26a88382c91f0e682dccdb8159fdc3ae5aa36af0d2629003bbd92fd622d401533956a4e637a06f83e50b97c4fbb9a430b9832
7
- data.tar.gz: 3a5aafc4e04d5619e2f15bef227e1a7e7d741e03caaa1587d3aee0a6533b7608a9816bd475b2a8275ae93478a157d664d5e7f7383100b651a615718925797069
6
+ metadata.gz: 32b6e9d61f486610caf886e48022162398e4c6261319e1d9a6c59e7ab99cc256886b6c8b16f98a841fc0a94079c638a6146b513ce10de4f2d2ef632bc6ecb0f2
7
+ data.tar.gz: f979bc0ce53a13bc4f81beda3c4371aa00e4579d871043926606719f39f845c679d50c2272d64488b4a812912fbdeece74c0cf5f8ec1e929234c476d9498f745
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
- ## [Unreleased]
1
+ ## Unreleased
2
2
 
3
- # [0.2.0] - 10/07/2023
3
+ ## [0.2.2] - 10/08/2023
4
+
5
+ - Fixed a bug where `ClassDeclaration` wasn't properly serializing it's data types.
6
+
7
+ ## [0.2.1] - 10/07/2023
8
+
9
+ - Added a `Parser#find_all_tag_names` method to the parser that returns a Hash keyed off the tag name.
10
+
11
+ ## [0.2.0] - 10/07/2023
4
12
 
5
13
  - Added a `Parser#find_by_tag_names(['tag-name'])` method to the parser that returns a Hash keyed off the tag name.
6
14
  - Removed `tag_names` as a parameters for `Parser#find_custom_elements`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- custom_elements_manifest_parser (0.2.0)
4
+ custom_elements_manifest_parser (0.2.2)
5
5
  dry-struct (~> 1.0)
6
6
  dry-types (~> 1.0)
7
7
  dry-validation (~> 1.0)
data/README.md CHANGED
@@ -63,8 +63,12 @@ end
63
63
  hash = parser.find_by_tag_names("light-pen", "light-preview")
64
64
  hash = parser.find_by_tag_names(["light-pen", "light-preview"])
65
65
 
66
- hash["light-pen"] # => declaration
67
- hash["light-preview"] # => declaration
66
+ hash["light-pen"] # => ClassDeclaration
67
+ hash["light-preview"] # => ClassDeclaration
68
+
69
+ # Finds every declaration with a "tagName"
70
+ hash = parser.find_all_tag_names
71
+ hash["light-preview"] # => ClassDeclaration
68
72
 
69
73
  # Searches for all custom elements regardless of tagName
70
74
  parser.find_custom_elements.each do |declaration|
@@ -29,7 +29,7 @@ module CustomElementsManifestParser
29
29
 
30
30
  hash = hash.merge(
31
31
  Structs::DeclarableNodeStruct.build_hash(parser: parser, struct: self),
32
- Structs::DeclarableNodeStruct.build_hash(parser: parser, struct: self)
32
+ Structs::CustomElementLikeStruct.build_hash(parser: parser, struct: self)
33
33
  )
34
34
 
35
35
  new(hash)
@@ -122,5 +122,23 @@ module CustomElementsManifestParser
122
122
 
123
123
  custom_elements
124
124
  end
125
+
126
+ # @return [Hash{String => Nodes::ClassDeclaration}] - Returns a hash keyed off of found tagNames.
127
+ def find_all_tag_names
128
+ custom_elements = {}
129
+
130
+ manifest.modules.flatten.each do |mod|
131
+ mod.declarations.flatten.each do |dec|
132
+ # Needs to be != true because == false fails nil checks.
133
+ next if dec.attributes[:customElement] != true
134
+
135
+ tag_name = dec.attributes[:tagName]
136
+
137
+ custom_elements[tag_name] = dec if tag_name
138
+ end
139
+ end
140
+
141
+ custom_elements
142
+ end
125
143
  end
126
144
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CustomElementsManifestParser
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
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.0
4
+ version: 0.2.2
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-07 00:00:00.000000000 Z
11
+ date: 2023-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct