packwerk-haml 0.1.0

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.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +75 -0
  4. data/Gemfile +22 -0
  5. data/Gemfile.lock +190 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +32 -0
  8. data/Rakefile +16 -0
  9. data/lib/packwerk_haml/parser.rb +64 -0
  10. data/lib/packwerk_haml/version.rb +6 -0
  11. data/lib/packwerk_haml.rb +8 -0
  12. data/packwerk-haml.gemspec +40 -0
  13. data/sig/packwerk/haml.rbs +4 -0
  14. data/sorbet/config +4 -0
  15. data/sorbet/rbi/annotations/.gitattributes +1 -0
  16. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  17. data/sorbet/rbi/annotations/activesupport.rbi +136 -0
  18. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  19. data/sorbet/rbi/gems/.gitattributes +1 -0
  20. data/sorbet/rbi/gems/actionview@7.1.1.rbi +15004 -0
  21. data/sorbet/rbi/gems/activesupport@7.1.1.rbi +18784 -0
  22. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  23. data/sorbet/rbi/gems/base64@0.1.1.rbi +172 -0
  24. data/sorbet/rbi/gems/better_html@2.0.2.rbi +529 -0
  25. data/sorbet/rbi/gems/bigdecimal@3.1.4.rbi +77 -0
  26. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  27. data/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi +11545 -0
  28. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +8 -0
  29. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +90 -0
  30. data/sorbet/rbi/gems/crass@1.0.6.rbi +622 -0
  31. data/sorbet/rbi/gems/drb@2.1.1.rbi +1313 -0
  32. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  33. data/sorbet/rbi/gems/haml@6.2.3.rbi +1619 -0
  34. data/sorbet/rbi/gems/i18n@1.14.1.rbi +2325 -0
  35. data/sorbet/rbi/gems/json@2.6.3.rbi +1533 -0
  36. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  37. data/sorbet/rbi/gems/loofah@2.21.4.rbi +1021 -0
  38. data/sorbet/rbi/gems/m@1.6.2.rbi +257 -0
  39. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  40. data/sorbet/rbi/gems/minitest-focus@1.4.0.rbi +91 -0
  41. data/sorbet/rbi/gems/minitest@5.20.0.rbi +1509 -0
  42. data/sorbet/rbi/gems/mutex_m@0.1.2.rbi +91 -0
  43. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  44. data/sorbet/rbi/gems/nokogiri@1.15.4.rbi +7317 -0
  45. data/sorbet/rbi/gems/packwerk@3.1.0-752d37add96b9f4bf28492d7db152f6523b1d29c.rbi +2370 -0
  46. data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
  47. data/sorbet/rbi/gems/parser@3.2.2.4.rbi +7253 -0
  48. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  49. data/sorbet/rbi/gems/racc@1.7.1.rbi +161 -0
  50. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +8 -0
  51. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +716 -0
  52. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  53. data/sorbet/rbi/gems/rake@13.0.6.rbi +3042 -0
  54. data/sorbet/rbi/gems/rbi@0.1.1.rbi +2926 -0
  55. data/sorbet/rbi/gems/regexp_parser@2.8.2.rbi +3749 -0
  56. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
  57. data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +7075 -0
  58. data/sorbet/rbi/gems/rubocop-performance@1.19.1.rbi +3208 -0
  59. data/sorbet/rbi/gems/rubocop-shopify@2.14.0.rbi +8 -0
  60. data/sorbet/rbi/gems/rubocop-sorbet@0.7.4.rbi +1442 -0
  61. data/sorbet/rbi/gems/rubocop@1.57.0.rbi +56753 -0
  62. data/sorbet/rbi/gems/ruby-lsp@0.2.4.rbi +11 -0
  63. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  64. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  65. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +474 -0
  66. data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
  67. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23136 -0
  68. data/sorbet/rbi/gems/tapioca@0.11.9.rbi +3498 -0
  69. data/sorbet/rbi/gems/temple@0.10.3.rbi +1738 -0
  70. data/sorbet/rbi/gems/thor@1.2.2.rbi +3965 -0
  71. data/sorbet/rbi/gems/tilt@2.3.0.rbi +925 -0
  72. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5917 -0
  73. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +65 -0
  74. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  75. data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
  76. data/sorbet/rbi/gems/yarp@0.13.0.rbi +21646 -0
  77. data/sorbet/rbi/gems/zeitwerk@2.6.12.rbi +997 -0
  78. data/sorbet/tapioca/config.yml +13 -0
  79. data/sorbet/tapioca/require.rb +5 -0
  80. metadata +167 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4cf64b42e173ed5328da2eb231754268801673e2fb3b15a8d26f2a776a85e4ca
4
+ data.tar.gz: fedd16f49ea69842f7e8f9e5731067d64ed350258fde909e7fb158f188b0ab01
5
+ SHA512:
6
+ metadata.gz: b07c733e469e90ab115f088ede0924e31de5f0d49f8123c3968b51d540aca9002e2904c00546ee2233c8a4c5aa81a4769f5aede37f6246d7cc7e8f91cf7f7184
7
+ data.tar.gz: 39b1c6c4b9adfd3de8189881c9f13abc0b467756ad5e0ecb948ae46bee1be70e54fe057d86ec2599abe5aef647c8a41f5dae3ca3159072fccd6556b1adf45119
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,75 @@
1
+ inherit_gem:
2
+ rubocop-shopify: rubocop.yml
3
+
4
+ require:
5
+ - rubocop-performance
6
+ - rubocop-sorbet
7
+
8
+ AllCops:
9
+ TargetRubyVersion: 2.7
10
+ NewCops: disable
11
+ UseCache: true
12
+ SuggestExtensions: false
13
+ CacheRootDirectory: tmp
14
+ Exclude:
15
+ - "test/fixtures/**/*"
16
+
17
+ Sorbet/ConstantsFromStrings:
18
+ Enabled: true
19
+
20
+ Sorbet/ForbidIncludeConstLiteral:
21
+ Enabled: true
22
+
23
+ Sorbet/SignatureBuildOrder:
24
+ Enabled: true
25
+
26
+ Sorbet/KeywordArgumentOrdering:
27
+ Enabled: true
28
+
29
+ Sorbet/ValidSigil:
30
+ Enabled: true
31
+
32
+ Performance/AncestorsInclude: # new in 1.7
33
+ Enabled: true
34
+
35
+ Performance/BigDecimalWithNumericArgument: # new in 1.7
36
+ Enabled: true
37
+
38
+ Performance/BlockGivenWithExplicitBlock: # new in 1.9
39
+ Enabled: true
40
+
41
+ Performance/CollectionLiteralInLoop: # new in 1.8
42
+ Enabled: true
43
+
44
+ Performance/ConstantRegexp: # new in 1.9
45
+ Enabled: true
46
+
47
+ Performance/MethodObjectAsBlock: # new in 1.9
48
+ Enabled: true
49
+
50
+ Performance/RedundantEqualityComparisonBlock: # new in 1.10
51
+ Enabled: true
52
+
53
+ Performance/RedundantSortBlock: # new in 1.7
54
+ Enabled: true
55
+
56
+ Performance/RedundantSplitRegexpArgument: # new in 1.10
57
+ Enabled: true
58
+
59
+ Performance/RedundantStringChars: # new in 1.7
60
+ Enabled: true
61
+
62
+ Performance/ReverseFirst: # new in 1.7
63
+ Enabled: true
64
+
65
+ Performance/SortReverse: # new in 1.7
66
+ Enabled: true
67
+
68
+ Performance/Squeeze: # new in 1.7
69
+ Enabled: true
70
+
71
+ Performance/StringInclude: # new in 1.7
72
+ Enabled: true
73
+
74
+ Performance/Sum: # new in 1.8
75
+ Enabled: true
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in packwerk-haml.gemspec
6
+ gemspec
7
+
8
+ gem("packwerk", git: "https://github.com/richardmarbach/packwerk", branch: "configurable_parser_interface")
9
+
10
+ gem("rubocop-performance", require: false)
11
+ gem("rubocop-sorbet", require: false)
12
+ gem("rubocop-shopify", require: false)
13
+
14
+ group :development do
15
+ gem("minitest-focus", require: false)
16
+ gem("ruby-lsp", "~> 0.2.1")
17
+
18
+ gem("m")
19
+ gem("rake")
20
+ gem("tapioca", require: false)
21
+ gem("sorbet-static-and-runtime")
22
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,190 @@
1
+ GIT
2
+ remote: https://github.com/richardmarbach/packwerk
3
+ revision: 752d37add96b9f4bf28492d7db152f6523b1d29c
4
+ branch: configurable_parser_interface
5
+ specs:
6
+ packwerk (3.1.0)
7
+ activesupport (>= 6.0)
8
+ ast
9
+ better_html
10
+ bundler
11
+ constant_resolver (>= 0.2.0)
12
+ parallel
13
+ parser
14
+ sorbet-runtime (>= 0.5.9914)
15
+ zeitwerk (>= 2.6.1)
16
+
17
+ PATH
18
+ remote: .
19
+ specs:
20
+ packwerk-haml (0.1.0)
21
+ ast
22
+ haml (~> 6.2)
23
+ parser
24
+
25
+ GEM
26
+ remote: https://rubygems.org/
27
+ specs:
28
+ actionview (7.1.1)
29
+ activesupport (= 7.1.1)
30
+ builder (~> 3.1)
31
+ erubi (~> 1.11)
32
+ rails-dom-testing (~> 2.2)
33
+ rails-html-sanitizer (~> 1.6)
34
+ activesupport (7.1.1)
35
+ base64
36
+ bigdecimal
37
+ concurrent-ruby (~> 1.0, >= 1.0.2)
38
+ connection_pool (>= 2.2.5)
39
+ drb
40
+ i18n (>= 1.6, < 2)
41
+ minitest (>= 5.1)
42
+ mutex_m
43
+ tzinfo (~> 2.0)
44
+ ast (2.4.2)
45
+ base64 (0.1.1)
46
+ better_html (2.0.2)
47
+ actionview (>= 6.0)
48
+ activesupport (>= 6.0)
49
+ ast (~> 2.0)
50
+ erubi (~> 1.4)
51
+ parser (>= 2.4)
52
+ smart_properties
53
+ bigdecimal (3.1.4)
54
+ builder (3.2.4)
55
+ concurrent-ruby (1.2.2)
56
+ connection_pool (2.4.1)
57
+ constant_resolver (0.2.0)
58
+ crass (1.0.6)
59
+ drb (2.1.1)
60
+ ruby2_keywords
61
+ erubi (1.12.0)
62
+ haml (6.2.3)
63
+ temple (>= 0.8.2)
64
+ thor
65
+ tilt
66
+ i18n (1.14.1)
67
+ concurrent-ruby (~> 1.0)
68
+ json (2.6.3)
69
+ language_server-protocol (3.17.0.3)
70
+ loofah (2.21.4)
71
+ crass (~> 1.0.2)
72
+ nokogiri (>= 1.12.0)
73
+ m (1.6.2)
74
+ method_source (>= 0.6.7)
75
+ rake (>= 0.9.2.2)
76
+ method_source (1.0.0)
77
+ minitest (5.20.0)
78
+ minitest-focus (1.4.0)
79
+ minitest (>= 4, < 6)
80
+ mutex_m (0.1.2)
81
+ netrc (0.11.0)
82
+ nokogiri (1.15.4-arm64-darwin)
83
+ racc (~> 1.4)
84
+ nokogiri (1.15.4-x86_64-linux)
85
+ racc (~> 1.4)
86
+ parallel (1.23.0)
87
+ parser (3.2.2.4)
88
+ ast (~> 2.4.1)
89
+ racc
90
+ prettier_print (1.2.1)
91
+ racc (1.7.1)
92
+ rails-dom-testing (2.2.0)
93
+ activesupport (>= 5.0.0)
94
+ minitest
95
+ nokogiri (>= 1.6)
96
+ rails-html-sanitizer (1.6.0)
97
+ loofah (~> 2.21)
98
+ nokogiri (~> 1.14)
99
+ rainbow (3.1.1)
100
+ rake (13.0.6)
101
+ rbi (0.1.1)
102
+ sorbet-runtime (>= 0.5.9204)
103
+ yarp (>= 0.11.0)
104
+ regexp_parser (2.8.2)
105
+ rexml (3.2.6)
106
+ rubocop (1.57.0)
107
+ base64 (~> 0.1.1)
108
+ json (~> 2.3)
109
+ language_server-protocol (>= 3.17.0)
110
+ parallel (~> 1.10)
111
+ parser (>= 3.2.2.4)
112
+ rainbow (>= 2.2.2, < 4.0)
113
+ regexp_parser (>= 1.8, < 3.0)
114
+ rexml (>= 3.2.5, < 4.0)
115
+ rubocop-ast (>= 1.28.1, < 2.0)
116
+ ruby-progressbar (~> 1.7)
117
+ unicode-display_width (>= 2.4.0, < 3.0)
118
+ rubocop-ast (1.29.0)
119
+ parser (>= 3.2.1.0)
120
+ rubocop-performance (1.19.1)
121
+ rubocop (>= 1.7.0, < 2.0)
122
+ rubocop-ast (>= 0.4.0)
123
+ rubocop-shopify (2.14.0)
124
+ rubocop (~> 1.51)
125
+ rubocop-sorbet (0.7.4)
126
+ rubocop (>= 0.90.0)
127
+ ruby-lsp (0.2.4)
128
+ language_server-protocol
129
+ sorbet-runtime
130
+ syntax_tree (>= 2.4)
131
+ ruby-progressbar (1.13.0)
132
+ ruby2_keywords (0.0.5)
133
+ smart_properties (1.17.0)
134
+ sorbet (0.5.11072)
135
+ sorbet-static (= 0.5.11072)
136
+ sorbet-runtime (0.5.11072)
137
+ sorbet-static (0.5.11072-universal-darwin)
138
+ sorbet-static (0.5.11072-x86_64-linux)
139
+ sorbet-static-and-runtime (0.5.11072)
140
+ sorbet (= 0.5.11072)
141
+ sorbet-runtime (= 0.5.11072)
142
+ spoom (1.2.4)
143
+ erubi (>= 1.10.0)
144
+ sorbet-static-and-runtime (>= 0.5.10187)
145
+ syntax_tree (>= 6.1.1)
146
+ thor (>= 0.19.2)
147
+ syntax_tree (6.2.0)
148
+ prettier_print (>= 1.2.0)
149
+ tapioca (0.11.9)
150
+ bundler (>= 2.2.25)
151
+ netrc (>= 0.11.0)
152
+ parallel (>= 1.21.0)
153
+ rbi (~> 0.1.0, >= 0.1.0)
154
+ sorbet-static-and-runtime (>= 0.5.10187)
155
+ spoom (~> 1.2.0, >= 1.2.0)
156
+ thor (>= 1.2.0)
157
+ yard-sorbet
158
+ temple (0.10.3)
159
+ thor (1.2.2)
160
+ tilt (2.3.0)
161
+ tzinfo (2.0.6)
162
+ concurrent-ruby (~> 1.0)
163
+ unicode-display_width (2.5.0)
164
+ yard (0.9.34)
165
+ yard-sorbet (0.8.1)
166
+ sorbet-runtime (>= 0.5)
167
+ yard (>= 0.9)
168
+ yarp (0.13.0)
169
+ zeitwerk (2.6.12)
170
+
171
+ PLATFORMS
172
+ arm64-darwin-21
173
+ arm64-darwin-22
174
+ x86_64-linux
175
+
176
+ DEPENDENCIES
177
+ m
178
+ minitest-focus
179
+ packwerk!
180
+ packwerk-haml!
181
+ rake
182
+ rubocop-performance
183
+ rubocop-shopify
184
+ rubocop-sorbet
185
+ ruby-lsp (~> 0.2.1)
186
+ sorbet-static-and-runtime
187
+ tapioca
188
+
189
+ BUNDLED WITH
190
+ 2.4.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Richard Marbach
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Packwerk Haml
2
+
3
+ Add haml support to [packwerk](https://github.com/Shopify/packwerk/)
4
+
5
+ ## Installation
6
+
7
+ 1. Add the gem to your Gemfile
8
+
9
+ ```ruby
10
+ gem "packwerk-haml"
11
+ ```
12
+
13
+ 2. Require `packwerk-haml` in your `packwerk.yml`
14
+
15
+ ```yml
16
+ require:
17
+ - packwerk-haml
18
+ ```
19
+
20
+ ## Development
21
+
22
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
23
+
24
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
25
+
26
+ ## Contributing
27
+
28
+ Bug reports and pull requests are welcome on GitHub at https://github.com/richardmarbach/packwerk-haml.
29
+
30
+ ## License
31
+
32
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: [:test, :rubocop, :sorbet]
@@ -0,0 +1,64 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ require "haml"
5
+ require "ast/node"
6
+
7
+ module PackwerkHaml
8
+ class Parser
9
+ extend T::Sig
10
+
11
+ include ::Packwerk::FileParser
12
+
13
+ sig { params(haml_compiler: T.untyped, ruby_parser: ::Packwerk::Parsers::Ruby).void }
14
+ def initialize(haml_compiler: ::Haml::Engine.new, ruby_parser: ::Packwerk::Parsers::Ruby.new)
15
+ @haml_compiler = haml_compiler
16
+ @ruby_parser = ruby_parser
17
+ end
18
+
19
+ sig { override.params(io: T.any(StringIO, IO), file_path: String).returns(T.untyped) }
20
+ def call(io:, file_path: "<unknown>")
21
+ parse_template(io.read, file_path: file_path)
22
+ end
23
+
24
+ sig { override.params(path: String).returns(T::Boolean) }
25
+ def match?(path:)
26
+ File.extname(path) == ".haml"
27
+ end
28
+
29
+ private
30
+
31
+ def parse_template(template, file_path:)
32
+ compiled = @haml_compiler.call(template)
33
+ to_ruby_ast(compiled, file_path)
34
+ rescue EncodingError => e
35
+ result = ::Packwerk::Parsers::ParseResult.new(file: file_path, message: e.message)
36
+ raise ::Packwerk::Parsers::ParseError, result
37
+ rescue ::Parser::SyntaxError => e
38
+ result = ::Packwerk::Parsers::ParseResult.new(file: file_path, message: "Syntax error: #{e}")
39
+ raise ::Packwerk::Parsers::ParseError, result
40
+ end
41
+
42
+ def to_ruby_ast(code, file_path)
43
+ @ruby_parser.call(
44
+ io: StringIO.new(code),
45
+ file_path: file_path,
46
+ )
47
+ end
48
+
49
+ CODE_NODES = [:haml_comment, :silent_script].freeze
50
+
51
+ sig { params(node: T.nilable(::Haml::Parser::ParseNode), block: T.untyped).returns(T.untyped) }
52
+ def code_nodes(node, &block)
53
+ return enum_for(:code_nodes, node) unless block
54
+
55
+ return unless node.is_a?(::Haml::Parser::ParseNode)
56
+
57
+ yield node if CODE_NODES.include?(node.type)
58
+
59
+ node.children.each do |child|
60
+ code_nodes(child, &block)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,6 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module PackwerkHaml
5
+ VERSION = "0.1.0"
6
+ end
@@ -0,0 +1,8 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "packwerk"
5
+ require "packwerk_haml/parser"
6
+
7
+ module PackwerkHaml
8
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/packwerk_haml/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "packwerk-haml"
7
+ spec.version = PackwerkHaml::VERSION
8
+ spec.authors = ["Richard Marbach"]
9
+ spec.email = ["rmarbach@gmail.com"]
10
+
11
+ spec.summary = "HAML support for packwerk"
12
+ spec.description = "HAML support for packwerk"
13
+ spec.homepage = "https://github.com/richardmarbach/packwerk-haml"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/richardmarbach/packwerk-haml"
21
+ spec.metadata["changelog_uri"] = "https://github.com/richardmarbach/packwerk-haml"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ %x(git ls-files -z).split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # For Ruby parsing
35
+ spec.add_dependency("ast")
36
+ spec.add_dependency("parser")
37
+
38
+ # For HAML parsing
39
+ spec.add_dependency("haml", "~>6.2")
40
+ end
@@ -0,0 +1,4 @@
1
+ module Packwerk
2
+ module Haml
3
+ end
4
+ end
data/sorbet/config ADDED
@@ -0,0 +1,4 @@
1
+ --dir
2
+ .
3
+ --ignore=tmp/
4
+ --ignore=vendor/
@@ -0,0 +1 @@
1
+ **/*.rbi linguist-vendored=true
@@ -0,0 +1,75 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This file was pulled from a central RBI files repository.
5
+ # Please run `bin/tapioca annotations` to update it.
6
+
7
+ module ActionView
8
+ TemplateError = T.type_alias { Template::Error }
9
+
10
+ class MissingTemplate < ActionView::ActionViewError
11
+ sig { returns(String) }
12
+ def path; end
13
+ end
14
+ end
15
+
16
+ class ActionView::Helpers::FormBuilder
17
+ sig { returns(T.untyped) }
18
+ def object; end
19
+ end
20
+
21
+ module ActionView::Helpers::NumberHelper
22
+ sig { params(number: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(T.nilable(String)) }
23
+ def number_to_currency(number, options = T.unsafe(nil)); end
24
+
25
+ sig { params(number: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(T.nilable(String)) }
26
+ def number_to_human(number, options = T.unsafe(nil)); end
27
+
28
+ sig { params(number: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(T.nilable(String)) }
29
+ def number_to_human_size(number, options = T.unsafe(nil)); end
30
+
31
+ sig { params(number: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(T.nilable(String)) }
32
+ def number_to_percentage(number, options = T.unsafe(nil)); end
33
+
34
+ sig { params(number: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(T.nilable(String)) }
35
+ def number_to_phone(number, options = T.unsafe(nil)); end
36
+
37
+ sig { params(number: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(T.nilable(String)) }
38
+ def number_with_delimiter(number, options = T.unsafe(nil)); end
39
+
40
+ sig { params(number: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(T.nilable(String)) }
41
+ def number_with_precision(number, options = T.unsafe(nil)); end
42
+ end
43
+
44
+ module ActionView::Helpers::SanitizeHelper
45
+ mixes_in_class_methods ActionView::Helpers::SanitizeHelper::ClassMethods
46
+ end
47
+
48
+ module ActionView::Helpers::UrlHelper
49
+ extend ActiveSupport::Concern
50
+ include ActionView::Helpers::TagHelper
51
+ mixes_in_class_methods ActionView::Helpers::UrlHelper::ClassMethods
52
+
53
+ sig { params(name: T.nilable(String), options: T.untyped, html_options: T.untyped, block: T.untyped).returns(ActiveSupport::SafeBuffer) }
54
+ def link_to(name = nil, options = nil, html_options = nil, &block); end
55
+
56
+ sig { params(condition: T.untyped, name: String, options: T.untyped, html_options: T.untyped, block: T.untyped).returns(T.untyped) }
57
+ def link_to_if(condition, name, options = {}, html_options = {}, &block); end
58
+ end
59
+
60
+ module ActionView::Layouts
61
+ mixes_in_class_methods ActionView::Layouts::ClassMethods
62
+ end
63
+
64
+ module ActionView::Rendering
65
+ mixes_in_class_methods ActionView::Rendering::ClassMethods
66
+ end
67
+
68
+ module ActionView::ViewPaths
69
+ mixes_in_class_methods ActionView::ViewPaths::ClassMethods
70
+ end
71
+
72
+ module ActionView::ViewPaths::ClassMethods
73
+ sig { params(value: T.any(String, T::Array[String])).void }
74
+ def append_view_path(value); end
75
+ end