hot_module 1.0.0.alpha9 → 1.0.0.alpha10

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: 8ee386965712348631ddb7f2727e757c6a3665de96bad4ce22e5d92cc41bff07
4
- data.tar.gz: 4ae0fce88ec73e62512105db857cd6406778dbf75d850bfce3bdb1ef02a7321b
3
+ metadata.gz: 84445fa8f0ceb1c241dc1497597ff16665383a4bcea444d41569ba673cf51e84
4
+ data.tar.gz: 8416c036a600a2655c1e1883238d49b9cfefe187b35be5e93f7aa4508c364e15
5
5
  SHA512:
6
- metadata.gz: 829ba7ad837dd654893f48c381930ec50144094d0c4c2efd06efbd9925175d35e784a9a6097aedbf756cd018cfe11737be6f59d9eb994e4ff1ccba7d3fd04096
7
- data.tar.gz: 5435dc0c0e835c12ce9458787a8681d1a86d259af1fd086edc8e8844f082ce6e75e820914befb5bb2ac88848a57d61219dacef3813d629b8bc554090c05199aa
6
+ metadata.gz: 6285f80875501f2b04b28f10bfdf7f9145a4a5a6843a3f01ed3b3a2c0848d9584b829e1ee5b0048c41d70dde248aa8f506be25155fae1a94472c57c46c77669d
7
+ data.tar.gz: ca42664335930b9468bdcd0d2e09620cd5b3b81cd2e3dfbc1fd2bd256cabe12515796f7288fa3051d59dfe80fbb5164205f1d906d270ca43e75191b36973228f
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.0.alpha10] - 2023-04-04
4
+
5
+ - Update debugging features based on Nokolexbor fixes
6
+
3
7
  ## [1.0.0.alpha9] - 2023-04-02
4
8
 
5
- - Add support for [@crystallized/shadow-effects](https://github.com/whitefusionhq/crystallized/tree/main/packages/shadow-effects) template syntax
9
+ - Add support for [@crystallized/shadow-effects](https://github.com/hotmodule/crystallized/tree/main/packages/shadow-effects) template syntax
6
10
  - Let `camelcased` handle symbol arrays, so it works with `attr_reader`
7
11
 
8
12
  ## [1.0.0.alpha8] - 2023-03-23
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot_module (1.0.0.alpha9)
5
- nokolexbor (~> 0.4)
4
+ hot_module (1.0.0.alpha10)
5
+ nokolexbor (>= 0.4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -33,9 +33,9 @@ GEM
33
33
  racc (~> 1.4)
34
34
  nokogiri (1.14.2-x86_64-linux)
35
35
  racc (~> 1.4)
36
- nokolexbor (0.4.0-arm64-darwin)
36
+ nokolexbor (0.4.2-arm64-darwin)
37
37
  parallel (1.22.1)
38
- parser (3.2.1.1)
38
+ parser (3.2.2.0)
39
39
  ast (~> 2.4.1)
40
40
  racc (1.6.2)
41
41
  rainbow (3.1.1)
@@ -44,17 +44,17 @@ GEM
44
44
  reverse_markdown (2.1.1)
45
45
  nokogiri
46
46
  rexml (3.2.5)
47
- rubocop (1.48.1)
47
+ rubocop (1.49.0)
48
48
  json (~> 2.3)
49
49
  parallel (~> 1.10)
50
50
  parser (>= 3.2.0.0)
51
51
  rainbow (>= 2.2.2, < 4.0)
52
52
  regexp_parser (>= 1.8, < 3.0)
53
53
  rexml (>= 3.2.5, < 4.0)
54
- rubocop-ast (>= 1.26.0, < 2.0)
54
+ rubocop-ast (>= 1.28.0, < 2.0)
55
55
  ruby-progressbar (~> 1.7)
56
56
  unicode-display_width (>= 2.4.0, < 3.0)
57
- rubocop-ast (1.27.0)
57
+ rubocop-ast (1.28.0)
58
58
  parser (>= 3.2.1.0)
59
59
  rubocop-minitest (0.22.2)
60
60
  rubocop (>= 0.90, < 2.0)
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Parse, mutate, and render custom elements in Ruby using [HTML Modules](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/html-modules-explainer.md).
4
4
 
5
- Great for pairing with [esbuild-plugin-html-modules](https://github.com/whitefusionhq/esbuild-plugin-html-modules) for a full-stack component rendering pipeline.
5
+ Great for pairing with [esbuild-plugin-html-modules](https://github.com/hotmodule/esbuild-plugin-html-modules) for a full-stack component rendering pipeline.
6
6
 
7
7
  ## Installation
8
8
 
@@ -26,7 +26,7 @@ To install this gem onto your local machine, run `bin/rake install`. To release
26
26
 
27
27
  ## Contributing
28
28
 
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/whitefusionhq/hot_module. 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/whitefusionhq/hot_module/blob/main/CODE_OF_CONDUCT.md).
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hotmodule/hot_module. 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/hotmodule/hot_module/blob/main/CODE_OF_CONDUCT.md).
30
30
 
31
31
  ## License
32
32
 
@@ -34,4 +34,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
34
34
 
35
35
  ## Code of Conduct
36
36
 
37
- Everyone interacting in the HoTModuLe project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/whitefusionhq/hot_module/blob/main/CODE_OF_CONDUCT.md).
37
+ Everyone interacting in the HoTModuLe project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hotmodule/hot_module/blob/main/CODE_OF_CONDUCT.md).
data/hot_module.gemspec CHANGED
@@ -9,13 +9,13 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["jared@whitefusion.studio"]
10
10
 
11
11
  spec.summary = "Parse, mutate, and render HTML Modules in Ruby."
12
- spec.homepage = "https://github.com/whitefusionhq/hot_module#readme"
12
+ spec.homepage = "https://github.com/hotmodule/hot_module#readme"
13
13
  spec.license = "MIT"
14
14
  spec.required_ruby_version = ">= 3.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
- spec.metadata["source_code_uri"] = "https://github.com/whitefusionhq/hot_module"
18
- spec.metadata["changelog_uri"] = "https://github.com/whitefusionhq/hot_module/blob/main/CHANGELOG.md"
17
+ spec.metadata["source_code_uri"] = "https://github.com/hotmodule/hot_module"
18
+ spec.metadata["changelog_uri"] = "https://github.com/hotmodule/hot_module/blob/main/CHANGELOG.md"
19
19
  spec.metadata["rubygems_mfa_required"] = "true"
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  end
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_dependency "nokolexbor", "~> 0.4"
30
+ spec.add_dependency "nokolexbor", ">= 0.4.2"
31
31
 
32
32
  spec.add_development_dependency "hash_with_dot_access", "~> 1.2"
33
33
  end
@@ -2,10 +2,12 @@
2
2
 
3
3
  module HoTModuLe
4
4
  class Fragment
5
- def initialize(fragment, attribute_bindings, html_module:)
5
+ def initialize(fragment, component)
6
6
  @fragment = fragment
7
- @attribute_bindings = attribute_bindings
8
- @html_module = html_module
7
+ @component = component
8
+ @attribute_bindings = component.class.attribute_bindings.each do |attr_def|
9
+ attr_def.method = component.method(attr_def.method_name)
10
+ end
9
11
  end
10
12
 
11
13
  # NOTE: for some reason, the Nokogiri traverse method yields node children first, then the
@@ -32,7 +34,8 @@ module HoTModuLe
32
34
  break unless attribute_binding.method.(attribute: attr_node, node: node)
33
35
  end
34
36
  rescue Exception => e # rubocop:disable Lint/RescueException
35
- raise e.class, e.message.lines.first, ["#{@html_module}:#{attr_node}", *e.backtrace]
37
+ line_segments = [@component.class.html_module, @component.class.line_number_of_node(attr_node)]
38
+ raise e.class, e.message.lines.first, [line_segments.join(":"), *e.backtrace]
36
39
  end
37
40
  end
38
41
  end
@@ -23,7 +23,7 @@ module HoTModuLe
23
23
  process_list(
24
24
  attribute: attribute,
25
25
  node: node,
26
- item_node: node.children[0].element_children.first,
26
+ item_node: node.children[0].first_element_child,
27
27
  for_in: expression
28
28
  )
29
29
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module HoTModuLe
4
4
  # @return [String]
5
- VERSION = "1.0.0.alpha9"
5
+ VERSION = "1.0.0.alpha10"
6
6
  end
data/lib/hot_module.rb CHANGED
@@ -92,9 +92,15 @@ module HoTModuLe
92
92
 
93
93
  # @return [Nokogiri::XML::Element]
94
94
  def doc
95
- @doc ||= Nokolexbor::DocumentFragment.parse(
96
- "<#{tag_name}>#{File.read(html_module).strip}</#{tag_name}>"
97
- ).element_children.first
95
+ @doc ||= begin
96
+ @doc_html = "<#{tag_name}>#{File.read(html_module).strip}</#{tag_name}>"
97
+ Nokolexbor::DocumentFragment.parse(@doc_html).first_element_child
98
+ end
99
+ end
100
+
101
+ def line_number_of_node(node)
102
+ loc = node.source_location
103
+ instance_variable_get(:@doc_html)[0..loc].count("\n") + 1
98
104
  end
99
105
 
100
106
  def attribute_bindings
@@ -218,10 +224,7 @@ module HoTModuLe
218
224
  # @param fragment [Nokogiri::XML::Element]
219
225
  # @return [void]
220
226
  def process_fragment(fragment)
221
- Fragment.new(
222
- fragment, self.class.attribute_bindings.each { _1.method = method(_1.method_name) },
223
- html_module: self.class.html_module
224
- ).process
227
+ Fragment.new(fragment, self).process
225
228
  end
226
229
 
227
230
  def process_list(attribute:, node:, item_node:, for_in:) # rubocop:disable Metrics
@@ -247,10 +250,7 @@ module HoTModuLe
247
250
  _context_locals[lh[0]] = list_item
248
251
  _context_locals[lh[1]] = index if lh[1]
249
252
 
250
- Fragment.new(
251
- new_node, self.class.attribute_bindings,
252
- html_module: self.class.html_module
253
- ).process
253
+ Fragment.new(new_node, self).process
254
254
  end
255
255
  end
256
256
  end
@@ -260,7 +260,7 @@ module HoTModuLe
260
260
  _context_locals.keys.reverse_each do |name|
261
261
  eval_code = "#{name} = _context_locals[\"#{name}\"];" + eval_code
262
262
  end
263
- instance_eval(eval_code, self.class.html_module) # , attribute.line)
263
+ instance_eval(eval_code, self.class.html_module, self.class.line_number_of_node(attribute))
264
264
  end
265
265
 
266
266
  def class_list_for(obj)
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot_module
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha9
4
+ version: 1.0.0.alpha10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared White
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-02 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokolexbor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.4'
19
+ version: 0.4.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.4'
26
+ version: 0.4.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hash_with_dot_access
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -62,13 +62,13 @@ files:
62
62
  - lib/hot_module/query_selection.rb
63
63
  - lib/hot_module/shadow_effects.rb
64
64
  - lib/hot_module/version.rb
65
- homepage: https://github.com/whitefusionhq/hot_module#readme
65
+ homepage: https://github.com/hotmodule/hot_module#readme
66
66
  licenses:
67
67
  - MIT
68
68
  metadata:
69
- homepage_uri: https://github.com/whitefusionhq/hot_module#readme
70
- source_code_uri: https://github.com/whitefusionhq/hot_module
71
- changelog_uri: https://github.com/whitefusionhq/hot_module/blob/main/CHANGELOG.md
69
+ homepage_uri: https://github.com/hotmodule/hot_module#readme
70
+ source_code_uri: https://github.com/hotmodule/hot_module
71
+ changelog_uri: https://github.com/hotmodule/hot_module/blob/main/CHANGELOG.md
72
72
  rubygems_mfa_required: 'true'
73
73
  post_install_message:
74
74
  rdoc_options: []