makiri 0.15.0-aarch64-linux → 0.16.0-aarch64-linux

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: d9bef2471bfcd87d3e3c31bf6f4eeecef71202d81bf0bb46b7b71eee526cd1a4
4
- data.tar.gz: 1836c1d1ee430cba8a058d63411259483ad84f3f4a1fdb69aae53621f1093f68
3
+ metadata.gz: 651fa28c960d1fd0099870394fc7f19bef09e328ac4851d7102ebfbf9136a6a7
4
+ data.tar.gz: e84db4b38c9fbe3184b90cee36976b005521dfdca1165d10adf1c70970a36918
5
5
  SHA512:
6
- metadata.gz: 3f8c5b7d20a0190f05afd7e1d8c453979eeaf3dc7d1ec58e5314fdeb803e84d5a3bbbf6e1fa533b3827d0bc70b8b41269d5a5d2d06d79339c1244e3a5a10b7a4
7
- data.tar.gz: e93f2d6a31337fc9e23782b4e3e5a37196e5ef95a92b206868721f8dc04d0263a593eb5361fef0c2fa0a67ab037a3777faafb65bcbe06fa0f45bdf215430bdd1
6
+ metadata.gz: 9d9e73501a9744ecf0b16610f52cdf0f8ed17473914654b5bf719cdf3e84fd333cbe77f12305b0d0be9d52da6a9652a659c7a970e0a6e317a98edbe8b4c84b6c
7
+ data.tar.gz: 11627962979c3a7649f3ce09fc4bd5b7bc019626c675263ae73bae9434ebd003b565d9726bb0e8d0d497c80c01bbebfd79c0b677e40f894dcbad1135749b7e53
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.16.0] - 2026-10-10
4
+
5
+ ### Added
6
+
7
+ * `Makiri::NATIVE_VERSION` and `Makiri::NATIVE_RUBY_API_VERSION`: the gem
8
+ version and Ruby `MAJOR.MINOR` the native extension was built as.
9
+ `require "makiri"` raises `LoadError` for an extension built for another
10
+ Ruby (refused by the extension itself, before it defines anything) or as
11
+ another makiri version (e.g. a stale `lib/makiri/makiri.bundle` in a
12
+ checkout).
13
+ * `Node#child_count`, `#child_at(i)`, `#element_child_count` and
14
+ `#element_child_at(i)` (HTML and XML): count and index a child list without
15
+ building `#children`. A loop over the indexes in order costs O(1) a step,
16
+ also while other lists are read in between. Any child-list edit in the
17
+ document resets that, so a loop that edits as it indexes walks from the
18
+ nearer end after each edit. `child_at` returns nil for a negative index or
19
+ one past the end.
20
+ * `Node#first_child` (an alias of `#child`) and `#last_child`.
21
+ * `Node#root_node`, DOM `getRootNode()`: the Document, a DocumentFragment, or
22
+ the top of a detached subtree. An Attr is its own root.
23
+
24
+ ### Changed
25
+
26
+ * `#local_name`, `#prefix`, `#namespace_uri` and `#tag_name` return frozen,
27
+ interned Strings: every read of one name returns the same object. `#name`
28
+ still returns a new, mutable String.
29
+
3
30
  ## [0.15.0] - 2026-10-09
4
31
 
5
32
  ### Added
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Makiri
4
- VERSION = "0.15.0"
4
+ VERSION = "0.16.0"
5
5
  end
data/lib/makiri.rb CHANGED
@@ -2,17 +2,36 @@
2
2
 
3
3
  require_relative "makiri/version"
4
4
 
5
- # Native extension (a Rust crate). Located at lib/makiri/<ruby_abi>/makiri.{so,bundle}
6
- # (created by rake-compiler). Loading is gated so the gem can be required
7
- # in environments where the binary is not yet built (the require error
8
- # is then surfaced clearly).
9
- begin
10
- RUBY_VERSION =~ /(\d+\.\d+)/
11
- require_relative "makiri/#{Regexp.last_match(1)}/makiri"
12
- rescue LoadError
5
+ # Native extension (a Rust crate): lib/makiri/<major.minor>/makiri.<dlext> in a
6
+ # precompiled gem (one per Ruby), else lib/makiri/makiri.<dlext> (a source
7
+ # install, or a checkout's `rake compile`). The versioned one is required only
8
+ # if it is there: rescuing LoadError instead would also swallow the extension's
9
+ # own refusal (a binary built for another Ruby raises LoadError from its init)
10
+ # and load the fallback over it.
11
+ versioned = "makiri/#{RUBY_VERSION[/\A\d+\.\d+/]}/makiri"
12
+ if File.exist?(File.join(__dir__, "#{versioned}.#{RbConfig::CONFIG["DLEXT"]}"))
13
+ require_relative versioned
14
+ else
13
15
  require_relative "makiri/makiri"
14
16
  end
15
17
 
18
+ # The fallback loads lib/makiri/makiri.<dlext> whichever version of this gem's
19
+ # Ruby code is asking: a checkout (or a Bundler `path:` gem) keeps one binary
20
+ # from its last compile, and one from another gem version lacks or misnames
21
+ # methods. The extension states what it was built as, and a mismatch stops
22
+ # here; a binary older than the constant states nothing, a mismatch too. (A
23
+ # binary for another Ruby never gets this far: the extension refuses it
24
+ # before it defines anything.)
25
+ module Makiri
26
+ native_version = const_defined?(:NATIVE_VERSION, false) ? NATIVE_VERSION : "(unknown)"
27
+ if native_version != VERSION
28
+ raise LoadError,
29
+ "makiri's native extension was built as makiri #{native_version}, but was " \
30
+ "loaded by makiri #{VERSION}; rebuild it (`bundle exec rake clean compile` in a " \
31
+ "checkout, or reinstall the gem)"
32
+ end
33
+ end
34
+
16
35
  require_relative "makiri/error"
17
36
  require_relative "makiri/clone_via_dup"
18
37
  require_relative "makiri/xpath_syntax"
@@ -33,12 +33,12 @@ UNSAFE_ISLANDS = {
33
33
  "bridge/doc.rs" => 3,
34
34
  "bridge/fragment.rs" => 6,
35
35
  "bridge/gvl.rs" => 5,
36
- "bridge/html.rs" => 17,
36
+ "bridge/html.rs" => 18,
37
37
  "bridge/node_set.rs" => 8,
38
38
  "bridge/node_wrap.rs" => 1,
39
- "bridge/ruby.rs" => 18,
39
+ "bridge/ruby.rs" => 19,
40
40
  "bridge/stack.rs" => 1,
41
- "bridge/string.rs" => 30,
41
+ "bridge/string.rs" => 31,
42
42
  "bridge/typed.rs" => 21,
43
43
  "bridge/wrapper.rs" => 20,
44
44
  "bridge/xml.rs" => 11,
@@ -90,37 +90,37 @@ UNSAFE_ISLANDS = {
90
90
  FORBID_ROOTS = %w[css/mod.rs glue/mod.rs lexbor/css_match/mod.rs xml/mod.rs xpath/mod.rs].freeze
91
91
 
92
92
  FORBID_FILES = %w[
93
- bridge/dom_error.rs css/build.rs css/lower.rs
94
- css/mod.rs cutf8.rs cutf8/verify.rs
95
- dom_rules.rs engine_error.rs falloc/verify.rs
96
- glue/css.rs glue/html_doc.rs glue/html_node/css.rs
97
- glue/html_node/mutate.rs glue/html_node/read.rs glue/html_node/serialize.rs
98
- glue/mod.rs glue/node.rs glue/node_set.rs
99
- glue/query.rs glue/xml_doc.rs glue/xml_node/css.rs
100
- glue/xml_node/mod.rs glue/xml_node/mutate.rs glue/xml_node/ns.rs
101
- glue/xml_node/read.rs glue/xml_node/serialize.rs glue/xml_node/strings.rs
102
- glue/xpath_context.rs lexbor/adapter/dom_index.rs lexbor/contains_guard.rs
103
- lexbor/css_match/mod.rs lexbor/selector_text.rs limits.rs
104
- node_type.rs ptr_table.rs rust_tests.rs
105
- stack.rs text.rs utf8_input.rs
106
- xml/arena.rs xml/attr_key.rs xml/chars/expand.rs
107
- xml/chars/mod.rs xml/dom_name.rs xml/encoding_sniff.rs
108
- xml/index.rs xml/mod.rs xml/model.rs
109
- xml/mutate/attr.rs xml/mutate/copy.rs xml/mutate/edit.rs
110
- xml/mutate/factory.rs xml/mutate/insert.rs xml/mutate/mod.rs
111
- xml/mutate/ns.rs xml/ns_scope.rs xml/qname.rs
112
- xml/selftest.rs xml/serialize/bindings.rs xml/serialize/c14n.rs
113
- xml/serialize/mod.rs xml/serialize/out.rs xml/serialize/xml.rs
114
- xml/tree/cursor.rs xml/tree/decl.rs xml/tree/dtd.rs
115
- xml/tree/mod.rs xml/tree/scope.rs xml/verify.rs
116
- xml/xpath.rs xpath/abi.rs xpath/ast.rs
117
- xpath/ast_ops.rs xpath/attr_pred.rs xpath/axis.rs
118
- xpath/ctx.rs xpath/dom.rs xpath/eval.rs
119
- xpath/funcs/ext.rs xpath/funcs/mod.rs xpath/lex.rs
120
- xpath/limits.rs xpath/mod.rs xpath/nodetest.rs
121
- xpath/number.rs xpath/order.rs xpath/parse.rs
122
- xpath/step_index.rs xpath/str_cache.rs xpath/tests.rs
123
- xpath/value.rs xpath/verify.rs
93
+ bridge/dom_error.rs child_index.rs css/build.rs
94
+ css/lower.rs css/mod.rs cutf8.rs
95
+ cutf8/verify.rs dom_rules.rs engine_error.rs
96
+ falloc/verify.rs glue/css.rs glue/html_doc.rs
97
+ glue/html_node/css.rs glue/html_node/mutate.rs glue/html_node/read.rs
98
+ glue/html_node/serialize.rs glue/mod.rs glue/node.rs
99
+ glue/node_set.rs glue/query.rs glue/xml_doc.rs
100
+ glue/xml_node/css.rs glue/xml_node/mod.rs glue/xml_node/mutate.rs
101
+ glue/xml_node/ns.rs glue/xml_node/read.rs glue/xml_node/serialize.rs
102
+ glue/xml_node/strings.rs glue/xpath_context.rs lexbor/adapter/dom_index.rs
103
+ lexbor/contains_guard.rs lexbor/css_match/mod.rs lexbor/selector_text.rs
104
+ limits.rs node_type.rs ptr_table.rs
105
+ rust_tests.rs stack.rs text.rs
106
+ utf8_input.rs xml/arena.rs xml/attr_key.rs
107
+ xml/chars/expand.rs xml/chars/mod.rs xml/dom_name.rs
108
+ xml/encoding_sniff.rs xml/index.rs xml/mod.rs
109
+ xml/model.rs xml/mutate/attr.rs xml/mutate/copy.rs
110
+ xml/mutate/edit.rs xml/mutate/factory.rs xml/mutate/insert.rs
111
+ xml/mutate/mod.rs xml/mutate/ns.rs xml/ns_scope.rs
112
+ xml/qname.rs xml/selftest.rs xml/serialize/bindings.rs
113
+ xml/serialize/c14n.rs xml/serialize/mod.rs xml/serialize/out.rs
114
+ xml/serialize/xml.rs xml/tree/cursor.rs xml/tree/decl.rs
115
+ xml/tree/dtd.rs xml/tree/mod.rs xml/tree/scope.rs
116
+ xml/verify.rs xml/xpath.rs xpath/abi.rs
117
+ xpath/ast.rs xpath/ast_ops.rs xpath/attr_pred.rs
118
+ xpath/axis.rs xpath/ctx.rs xpath/dom.rs
119
+ xpath/eval.rs xpath/funcs/ext.rs xpath/funcs/mod.rs
120
+ xpath/lex.rs xpath/limits.rs xpath/mod.rs
121
+ xpath/nodetest.rs xpath/number.rs xpath/order.rs
122
+ xpath/parse.rs xpath/step_index.rs xpath/str_cache.rs
123
+ xpath/tests.rs xpath/value.rs xpath/verify.rs
124
124
  ].freeze
125
125
 
126
126
  UNSAFE_USE = /\bunsafe\s*(?:\{|fn\b|impl\b|trait\b|extern\b)/
@@ -166,7 +166,11 @@ RAW_NODE_CROSSING_COUNTS = {
166
166
  "bridge/fragment.rs" => 3,
167
167
  # 8th: an Attr's owner, read as the wrapper cache's identity key for the
168
168
  # owner-frozen check (`check_attr_owner_frozen`); it does not escape.
169
- "bridge/html.rs" => 8,
169
+ # 9th/10th: `TokenTree for HtmlTree` (`child_count` / `child_at`), a node's pointer as
170
+ # the child-position memo's token and back. `child_index::ChildPositionMemo`
171
+ # answers only for the `tree_version` it was filled under, so a token read
172
+ # back is still that child; the node is never handed out raw, only wrapped.
173
+ "bridge/html.rs" => 10,
170
174
  "bridge/wrapper.rs" => 3,
171
175
  }.freeze
172
176
 
@@ -718,6 +722,10 @@ def unwrapped_entries(rust)
718
722
  code.to_enum(:scan, REGISTRATION).each do
719
723
  m = Regexp.last_match
720
724
  fpath = first_argument(code, m.end(0) - 1)
725
+ # A generic function registered per representation
726
+ # (`child_count::<HtmlSelf>`) is one definition: resolve it without its
727
+ # type arguments.
728
+ fpath = fpath&.sub(/::<[\w:, ]+>\z/, "")
721
729
  unless fpath&.match?(/\A[\w:]+\z/)
722
730
  missing << "#{rel}: registration of `#{fpath}` is not a function path"
723
731
  next
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - takahashim