makiri 0.17.0.rc2 → 0.17.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +89 -1
- data/NOKOGIRI_DIFFERENCES.md +33 -6
- data/README.md +12 -5
- data/ext/makiri/rust/Cargo.lock +22 -50
- data/ext/makiri/rust/Cargo.toml +54 -100
- data/ext/makiri/rust/build.rs +4 -502
- data/ext/makiri/rust/engine/Cargo.toml +41 -0
- data/ext/makiri/rust/{src/cbuf.rs → engine/src/ceiling_buf.rs} +59 -29
- data/ext/makiri/rust/{src → engine/src}/child_index/tests.rs +25 -0
- data/ext/makiri/rust/{src → engine/src}/child_index.rs +39 -1
- data/ext/makiri/rust/{src → engine/src}/compat.rs +54 -13
- data/ext/makiri/rust/{src → engine/src}/conformance/mod.rs +10 -1
- data/ext/makiri/rust/{src → engine/src}/conformance/res_gen.rs +5 -5
- data/ext/makiri/rust/{src → engine/src}/css_cache.rs +7 -6
- data/ext/makiri/rust/{src → engine/src}/css_match/compile.rs +2 -2
- data/ext/makiri/rust/engine/src/css_match/lang.rs +126 -0
- data/ext/makiri/rust/{src → engine/src}/css_match/mod.rs +131 -93
- data/ext/makiri/rust/{src → engine/src}/css_match/nth_of.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/css_match/plan.rs +56 -3
- data/ext/makiri/rust/{src → engine/src}/css_match/positions.rs +1 -1
- data/ext/makiri/rust/engine/src/css_match/query/chain.rs +200 -0
- data/ext/makiri/rust/engine/src/css_match/query/has.rs +225 -0
- data/ext/makiri/rust/engine/src/css_match/query/mod.rs +392 -0
- data/ext/makiri/rust/engine/src/css_match/query/nth_of.rs +98 -0
- data/ext/makiri/rust/{src → engine/src}/css_match/scratch.rs +3 -3
- data/ext/makiri/rust/{src → engine/src}/css_match/simple.rs +44 -74
- data/ext/makiri/rust/{src → engine/src}/css_match/state.rs +40 -1
- data/ext/makiri/rust/{src → engine/src}/doc_cell.rs +7 -5
- data/ext/makiri/rust/{src → engine/src}/engine_error.rs +7 -7
- data/ext/makiri/rust/{src → engine/src}/html/dom/build.rs +2 -1
- data/ext/makiri/rust/{src → engine/src}/html/dom/conformance.rs +6 -0
- data/ext/makiri/rust/{src → engine/src}/html/dom/copy.rs +25 -20
- data/ext/makiri/rust/{src → engine/src}/html/dom/cross_import.rs +12 -3
- data/ext/makiri/rust/{src → engine/src}/html/dom/edit.rs +181 -93
- data/ext/makiri/rust/{src → engine/src}/html/dom/handle.rs +16 -1
- data/ext/makiri/rust/{src → engine/src}/html/dom/index.rs +5 -5
- data/ext/makiri/rust/{src → engine/src}/html/dom/mod.rs +97 -31
- data/ext/makiri/rust/{src → engine/src}/html/dom/serialize.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/dom/store.rs +1 -1
- data/ext/makiri/rust/engine/src/html/dom/tests.rs +408 -0
- data/ext/makiri/rust/{src → engine/src}/html/encoding/mod.rs +4 -4
- data/ext/makiri/rust/{src → engine/src}/html/fragment.rs +14 -9
- data/ext/makiri/rust/{src → engine/src}/html/names.rs +8 -2
- data/ext/makiri/rust/{src → engine/src}/html/tokenizer/mod.rs +14 -15
- data/ext/makiri/rust/{src → engine/src}/html/tokenizer/state.rs +2 -2
- data/ext/makiri/rust/{src → engine/src}/html/tokenizer/tests.rs +9 -0
- data/ext/makiri/rust/{src → engine/src}/html/tree/actions.rs +4 -4
- data/ext/makiri/rust/{src → engine/src}/html/tree/document_bytes.rs +3 -3
- data/ext/makiri/rust/{src → engine/src}/html/tree/fragment.rs +9 -4
- data/ext/makiri/rust/engine/src/html/tree/guard.rs +160 -0
- data/ext/makiri/rust/{src → engine/src}/html/tree/mod.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/tree/modes/foreign_content.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_body.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_frameset.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_table_text.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/tree/parse.rs +6 -6
- data/ext/makiri/rust/{src → engine/src}/html/tree/select.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/tree/stacks.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/html/tree/wpt_tests.rs +2 -2
- data/ext/makiri/rust/{src → engine/src}/html_dom.rs +1 -1
- data/ext/makiri/rust/engine/src/lib.rs +159 -0
- data/ext/makiri/rust/engine/src/limits.rs +24 -0
- data/ext/makiri/rust/engine/src/no_unwind.rs +86 -0
- data/ext/makiri/rust/{src → engine/src}/ptr_table.rs +69 -9
- data/ext/makiri/rust/{src → engine/src}/rust_tests.rs +13 -12
- data/ext/makiri/rust/{src → engine/src}/selectors/ast.rs +31 -0
- data/ext/makiri/rust/{src → engine/src}/selectors/mod.rs +2 -0
- data/ext/makiri/rust/engine/src/selectors/number.rs +138 -0
- data/ext/makiri/rust/{src → engine/src}/selectors/parser/syntax.rs +1 -0
- data/ext/makiri/rust/{src → engine/src}/selectors/parser.rs +213 -38
- data/ext/makiri/rust/{src → engine/src}/selectors/pseudo.rs +4 -1
- data/ext/makiri/rust/{src → engine/src}/selectors/specificity.rs +2 -1
- data/ext/makiri/rust/{src → engine/src}/selectors/stylesheet.rs +19 -16
- data/ext/makiri/rust/{src → engine/src}/selectors/text.rs +23 -3
- data/ext/makiri/rust/{src → engine/src}/selectors/token.rs +2 -1
- data/ext/makiri/rust/{src → engine/src}/selectors/tokenizer.rs +51 -7
- data/ext/makiri/rust/{src → engine/src}/source_lines.rs +32 -23
- data/ext/makiri/rust/engine/src/stack.rs +134 -0
- data/ext/makiri/rust/engine/src/swar.rs +39 -0
- data/ext/makiri/rust/{src → engine/src}/text.rs +12 -16
- data/ext/makiri/rust/{src → engine/src}/token.rs +1 -1
- data/ext/makiri/rust/engine/src/utf8_decode/exhaustive.rs +62 -0
- data/ext/makiri/rust/{src/cutf8.rs → engine/src/utf8_decode.rs} +29 -20
- data/ext/makiri/rust/{src → engine/src}/utf8_input.rs +5 -5
- data/ext/makiri/rust/{src → engine/src}/xml/arena.rs +6 -6
- data/ext/makiri/rust/{src → engine/src}/xml/attr_key.rs +3 -4
- data/ext/makiri/rust/{src → engine/src}/xml/chars/expand.rs +18 -10
- data/ext/makiri/rust/{src → engine/src}/xml/chars/mod.rs +11 -9
- data/ext/makiri/rust/{src → engine/src}/xml/css_tests.rs +116 -138
- data/ext/makiri/rust/{src → engine/src}/xml/dom_name.rs +85 -10
- data/ext/makiri/rust/{src → engine/src}/xml/encoding_sniff.rs +59 -3
- data/ext/makiri/rust/{src → engine/src}/xml/index.rs +4 -3
- data/ext/makiri/rust/{src → engine/src}/xml/mod.rs +0 -3
- data/ext/makiri/rust/{src → engine/src}/xml/model.rs +4 -4
- data/ext/makiri/rust/{src → engine/src}/xml/mutate/attr.rs +5 -5
- data/ext/makiri/rust/{src → engine/src}/xml/mutate/copy.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/xml/mutate/insert.rs +12 -0
- data/ext/makiri/rust/{src → engine/src}/xml/mutate/mod.rs +2 -2
- data/ext/makiri/rust/{src → engine/src}/xml/mutate/ns.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/xml/selftest.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/xml/serialize/bindings.rs +2 -2
- data/ext/makiri/rust/{src → engine/src}/xml/serialize/c14n.rs +16 -16
- data/ext/makiri/rust/{src → engine/src}/xml/serialize/mod.rs +99 -2
- data/ext/makiri/rust/{src → engine/src}/xml/serialize/out.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/xml/serialize/xml.rs +20 -14
- data/ext/makiri/rust/{src → engine/src}/xml/tree/dtd.rs +14 -6
- data/ext/makiri/rust/{src → engine/src}/xml/tree/mod.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/xml/tree/scope.rs +2 -2
- data/ext/makiri/rust/{src → engine/src}/xpath/abi.rs +1 -3
- data/ext/makiri/rust/{src → engine/src}/xpath/ast.rs +2 -12
- data/ext/makiri/rust/{src → engine/src}/xpath/attr_pred.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/xpath/ctx.rs +11 -5
- data/ext/makiri/rust/{src → engine/src}/xpath/dom.rs +2 -1
- data/ext/makiri/rust/{src → engine/src}/xpath/eval.rs +2 -7
- data/ext/makiri/rust/{src → engine/src}/xpath/funcs/mod.rs +6 -72
- data/ext/makiri/rust/{src → engine/src}/xpath/limits.rs +30 -20
- data/ext/makiri/rust/{src → engine/src}/xpath/mod.rs +2 -6
- data/ext/makiri/rust/{src → engine/src}/xpath/number.rs +24 -13
- data/ext/makiri/rust/{src → engine/src}/xpath/order.rs +7 -7
- data/ext/makiri/rust/{src → engine/src}/xpath/parse.rs +2 -3
- data/ext/makiri/rust/{src → engine/src}/xpath/str_cache.rs +1 -1
- data/ext/makiri/rust/{src → engine/src}/xpath/tests.rs +9 -143
- data/ext/makiri/rust/{src → engine/src}/xpath/value.rs +3 -3
- data/ext/makiri/rust/extconf.rb +24 -15
- data/ext/makiri/rust/falloc/Cargo.toml +18 -0
- data/ext/makiri/rust/{src/falloc → falloc/src}/inject.rs +2 -2
- data/ext/makiri/rust/{src/falloc/mod.rs → falloc/src/lib.rs} +27 -12
- data/ext/makiri/rust/nupur/Cargo.toml +24 -0
- data/ext/makiri/rust/nupur/src/abi.rs +143 -0
- data/ext/makiri/rust/nupur/src/args.rs +318 -0
- data/ext/makiri/rust/nupur/src/build.rs +96 -0
- data/ext/makiri/rust/nupur/src/caught.rs +171 -0
- data/ext/makiri/rust/nupur/src/cname.rs +37 -0
- data/ext/makiri/rust/nupur/src/describe.rs +175 -0
- data/ext/makiri/rust/nupur/src/encoding.rs +240 -0
- data/ext/makiri/rust/nupur/src/gvl.rs +181 -0
- data/ext/makiri/rust/nupur/src/hash.rs +52 -0
- data/ext/makiri/rust/nupur/src/inject.rs +20 -0
- data/ext/makiri/rust/nupur/src/lib.rs +280 -0
- data/ext/makiri/rust/nupur/src/lint_probe.rs +141 -0
- data/ext/makiri/rust/nupur/src/msg.rs +193 -0
- data/ext/makiri/rust/nupur/src/no_unwind.rs +39 -0
- data/ext/makiri/rust/nupur/src/raw/check.rs +71 -0
- data/ext/makiri/rust/nupur/src/raw/data.rs +28 -0
- data/ext/makiri/rust/nupur/src/raw/define.rs +215 -0
- data/ext/makiri/rust/nupur/src/raw/exception.rs +69 -0
- data/ext/makiri/rust/nupur/src/raw/iterate.rs +90 -0
- data/ext/makiri/rust/nupur/src/raw/mod.rs +105 -0
- data/ext/makiri/rust/nupur/src/raw/protect.rs +144 -0
- data/ext/makiri/rust/nupur/src/raw/string.rs +148 -0
- data/ext/makiri/rust/nupur/src/raw/symbol.rs +38 -0
- data/ext/makiri/rust/nupur/src/raw/values.rs +271 -0
- data/ext/makiri/rust/nupur/src/rb/call.rs +118 -0
- data/ext/makiri/rust/nupur/src/rb/class.rs +170 -0
- data/ext/makiri/rust/nupur/src/rb/convert.rs +134 -0
- data/ext/makiri/rust/nupur/src/rb/error.rs +355 -0
- data/ext/makiri/rust/nupur/src/rb/global.rs +141 -0
- data/ext/makiri/rust/nupur/src/rb/kept.rs +55 -0
- data/ext/makiri/rust/nupur/src/rb/method/frame.rs +55 -0
- data/ext/makiri/rust/nupur/src/rb/method.rs +466 -0
- data/ext/makiri/rust/nupur/src/rb/mod.rs +40 -0
- data/ext/makiri/rust/nupur/src/rb/object.rs +66 -0
- data/ext/makiri/rust/nupur/src/rb/ruby.rs +107 -0
- data/ext/makiri/rust/nupur/src/rb/value/header.rs +65 -0
- data/ext/makiri/rust/nupur/src/rb/value/id.rs +61 -0
- data/ext/makiri/rust/nupur/src/rb/value/integer.rs +132 -0
- data/ext/makiri/rust/nupur/src/rb/value.rs +454 -0
- data/ext/makiri/rust/nupur/src/stack.rs +32 -0
- data/ext/makiri/rust/nupur/src/string/make.rs +234 -0
- data/ext/makiri/rust/nupur/src/string/mod.rs +24 -0
- data/ext/makiri/rust/nupur/src/string/read.rs +411 -0
- data/ext/makiri/rust/nupur/src/table.rs +58 -0
- data/ext/makiri/rust/nupur/src/typed/callbacks.rs +125 -0
- data/ext/makiri/rust/nupur/src/typed/data_type.rs +132 -0
- data/ext/makiri/rust/nupur/src/typed/embedded.rs +103 -0
- data/ext/makiri/rust/nupur/src/typed/external.rs +76 -0
- data/ext/makiri/rust/nupur/src/typed/hidden.rs +95 -0
- data/ext/makiri/rust/nupur/src/typed/mod.rs +373 -0
- data/ext/makiri/rust/nupur/src/utf8_copy.rs +262 -0
- data/ext/makiri/rust/nupur/sys/Cargo.toml +29 -0
- data/ext/makiri/rust/nupur/sys/src/data_type.rs +213 -0
- data/ext/makiri/rust/nupur/sys/src/int.rs +248 -0
- data/ext/makiri/rust/nupur/sys/src/lib.rs +61 -0
- data/ext/makiri/rust/nupur/sys/src/lint_probe.rs +93 -0
- data/ext/makiri/rust/nupur/sys/src/no_unwind.rs +99 -0
- data/ext/makiri/rust/nupur/sys/src/non_raising.rs +585 -0
- data/ext/makiri/rust/nupur/sys/src/protect.rs +349 -0
- data/ext/makiri/rust/nupur/sys/src/raising.rs +255 -0
- data/ext/makiri/rust/nupur/sys/src/value.rs +279 -0
- data/ext/makiri/rust/src/bridge/dom.rs +4 -5
- data/ext/makiri/rust/src/bridge/dom_error.rs +16 -1
- data/ext/makiri/rust/src/bridge/{doc.rs → html/document.rs} +104 -87
- data/ext/makiri/rust/src/bridge/html/edit.rs +170 -0
- data/ext/makiri/rust/src/bridge/{fragment.rs → html/fragment.rs} +56 -71
- data/ext/makiri/rust/src/bridge/html/insert.rs +148 -0
- data/ext/makiri/rust/src/bridge/html/mod.rs +46 -0
- data/ext/makiri/rust/src/bridge/html/receiver.rs +316 -0
- data/ext/makiri/rust/src/bridge/html/wrap.rs +194 -0
- data/ext/makiri/rust/src/bridge/mod.rs +29 -31
- data/ext/makiri/rust/src/bridge/node_set/index.rs +78 -0
- data/ext/makiri/rust/src/bridge/node_set/mod.rs +521 -0
- data/ext/makiri/rust/src/bridge/node_set/storage.rs +226 -0
- data/ext/makiri/rust/src/bridge/node_wrap.rs +21 -13
- data/ext/makiri/rust/src/bridge/ruby.rs +13 -344
- data/ext/makiri/rust/src/bridge/stack.rs +9 -14
- data/ext/makiri/rust/src/bridge/string/build.rs +22 -70
- data/ext/makiri/rust/src/bridge/string/encoding.rs +52 -229
- data/ext/makiri/rust/src/bridge/string/mod.rs +13 -9
- data/ext/makiri/rust/src/bridge/string/source.rs +101 -69
- data/ext/makiri/rust/src/bridge/string/view.rs +140 -256
- data/ext/makiri/rust/src/bridge/wrapper/accounting.rs +47 -43
- data/ext/makiri/rust/src/bridge/wrapper/child_list.rs +77 -0
- data/ext/makiri/rust/src/bridge/wrapper/document.rs +200 -440
- data/ext/makiri/rust/src/bridge/wrapper/edit.rs +17 -78
- data/ext/makiri/rust/src/bridge/wrapper/ivar.rs +44 -0
- data/ext/makiri/rust/src/bridge/wrapper/mod.rs +10 -2
- data/ext/makiri/rust/src/bridge/wrapper/node.rs +189 -102
- data/ext/makiri/rust/src/bridge/wrapper/node_table.rs +144 -0
- data/ext/makiri/rust/src/bridge/xml/attrs.rs +50 -0
- data/ext/makiri/rust/src/bridge/xml/decode.rs +231 -0
- data/ext/makiri/rust/src/bridge/xml/document.rs +91 -0
- data/ext/makiri/rust/src/bridge/xml/edit.rs +260 -0
- data/ext/makiri/rust/src/bridge/xml/error.rs +117 -0
- data/ext/makiri/rust/src/bridge/xml/insert.rs +223 -0
- data/ext/makiri/rust/src/bridge/xml/mod.rs +67 -0
- data/ext/makiri/rust/src/bridge/xml/receiver.rs +139 -0
- data/ext/makiri/rust/src/bridge/xml/strings.rs +40 -0
- data/ext/makiri/rust/src/bridge/xml/wrap.rs +105 -0
- data/ext/makiri/rust/src/bridge/xpath/context_object.rs +146 -128
- data/ext/makiri/rust/src/bridge/xpath/mod.rs +111 -97
- data/ext/makiri/rust/src/glue/css.rs +112 -49
- data/ext/makiri/rust/src/glue/dom_names.rs +34 -0
- data/ext/makiri/rust/src/glue/html_doc.rs +104 -122
- data/ext/makiri/rust/src/glue/html_node/css.rs +25 -71
- data/ext/makiri/rust/src/glue/html_node/mod.rs +19 -27
- data/ext/makiri/rust/src/glue/html_node/mutate.rs +317 -333
- data/ext/makiri/rust/src/glue/html_node/read.rs +240 -287
- data/ext/makiri/rust/src/glue/html_node/serialize.rs +51 -34
- data/ext/makiri/rust/src/glue/kwargs.rs +44 -99
- data/ext/makiri/rust/src/glue/mod.rs +23 -15
- data/ext/makiri/rust/src/glue/namespaces.rs +89 -0
- data/ext/makiri/rust/src/glue/node.rs +50 -104
- data/ext/makiri/rust/src/glue/node_set.rs +117 -109
- data/ext/makiri/rust/src/glue/query.rs +49 -118
- data/ext/makiri/rust/src/glue/stylesheet.rs +67 -68
- data/ext/makiri/rust/src/glue/xml_doc.rs +48 -56
- data/ext/makiri/rust/src/glue/xml_node/css.rs +46 -72
- data/ext/makiri/rust/src/glue/xml_node/mod.rs +19 -17
- data/ext/makiri/rust/src/glue/xml_node/mutate.rs +242 -289
- data/ext/makiri/rust/src/glue/xml_node/ns.rs +82 -81
- data/ext/makiri/rust/src/glue/xml_node/read.rs +166 -205
- data/ext/makiri/rust/src/glue/xml_node/serialize.rs +237 -60
- data/ext/makiri/rust/src/glue/xpath_context.rs +66 -39
- data/ext/makiri/rust/src/init.rs +266 -248
- data/ext/makiri/rust/src/lib.rs +30 -184
- data/ext/makiri/rust/src/lint_probe.rs +160 -41
- data/lib/makiri/html/document.rb +12 -2
- data/lib/makiri/node.rb +19 -3
- data/lib/makiri/node_set.rb +4 -3
- data/lib/makiri/version.rb +1 -1
- data/lib/makiri/xml/node_methods.rb +2 -28
- data/lib/makiri/xpath_context.rb +10 -11
- data/lib/makiri.rb +1 -1
- metadata +272 -226
- data/ext/makiri/rust/src/bridge/alloc.rs +0 -153
- data/ext/makiri/rust/src/bridge/build.rs +0 -61
- data/ext/makiri/rust/src/bridge/gvl.rs +0 -100
- data/ext/makiri/rust/src/bridge/html.rs +0 -782
- data/ext/makiri/rust/src/bridge/node_set.rs +0 -725
- data/ext/makiri/rust/src/bridge/raw.rs +0 -504
- data/ext/makiri/rust/src/bridge/typed.rs +0 -635
- data/ext/makiri/rust/src/bridge/xml.rs +0 -905
- data/ext/makiri/rust/src/bridge/xml_decode.rs +0 -216
- data/ext/makiri/rust/src/caught.rs +0 -84
- data/ext/makiri/rust/src/cbuf/verify.rs +0 -58
- data/ext/makiri/rust/src/css/build.rs +0 -264
- data/ext/makiri/rust/src/css/lower.rs +0 -657
- data/ext/makiri/rust/src/css/mod.rs +0 -186
- data/ext/makiri/rust/src/css_match/query.rs +0 -854
- data/ext/makiri/rust/src/cutf8/verify.rs +0 -143
- data/ext/makiri/rust/src/falloc/verify.rs +0 -78
- data/ext/makiri/rust/src/glue/hash.rs +0 -48
- data/ext/makiri/rust/src/gvl.rs +0 -179
- data/ext/makiri/rust/src/html/dom/tests.rs +0 -150
- data/ext/makiri/rust/src/html/tree/guard.rs +0 -91
- data/ext/makiri/rust/src/lexbor/abi.rs +0 -218
- data/ext/makiri/rust/src/lexbor/adapter/arena_bytes.rs +0 -240
- data/ext/makiri/rust/src/lexbor/adapter/arena_copy.rs +0 -171
- data/ext/makiri/rust/src/lexbor/adapter/html/attrs.rs +0 -443
- data/ext/makiri/rust/src/lexbor/adapter/html/build.rs +0 -304
- data/ext/makiri/rust/src/lexbor/adapter/html/mod.rs +0 -1476
- data/ext/makiri/rust/src/lexbor/adapter/html/serialize.rs +0 -435
- data/ext/makiri/rust/src/lexbor/adapter/mod.rs +0 -58
- data/ext/makiri/rust/src/lexbor/adapter/post_parse.rs +0 -237
- data/ext/makiri/rust/src/lexbor/adapter/source_loc.rs +0 -171
- data/ext/makiri/rust/src/lexbor/adapter/tree_guard.rs +0 -298
- data/ext/makiri/rust/src/lexbor/chunks.rs +0 -98
- data/ext/makiri/rust/src/lexbor/conformance_tests.rs +0 -1196
- data/ext/makiri/rust/src/lexbor/contains_guard.rs +0 -178
- data/ext/makiri/rust/src/lexbor/css_engine.rs +0 -236
- data/ext/makiri/rust/src/lexbor/css_parser.rs +0 -629
- data/ext/makiri/rust/src/lexbor/css_tokens.rs +0 -192
- data/ext/makiri/rust/src/lexbor/fragment.rs +0 -446
- data/ext/makiri/rust/src/lexbor/mod.rs +0 -107
- data/ext/makiri/rust/src/lexbor/res_tests.rs +0 -452
- data/ext/makiri/rust/src/lexbor/selector_diff.rs +0 -157
- data/ext/makiri/rust/src/lexbor/selector_port_tests.rs +0 -1123
- data/ext/makiri/rust/src/lexbor/selectors.rs +0 -428
- data/ext/makiri/rust/src/lexbor/serialize.rs +0 -146
- data/ext/makiri/rust/src/lexbor/stylesheet_diff.rs +0 -340
- data/ext/makiri/rust/src/lexbor/tests.rs +0 -2829
- data/ext/makiri/rust/src/lexbor/tree_diff.rs +0 -477
- data/ext/makiri/rust/src/lexbor/tree_port_tests.rs +0 -838
- data/ext/makiri/rust/src/lexbor/twin.rs +0 -71
- data/ext/makiri/rust/src/limits.rs +0 -10
- data/ext/makiri/rust/src/stack.rs +0 -48
- data/ext/makiri/rust/src/xml/verify.rs +0 -105
- data/ext/makiri/rust/src/xpath/funcs/css_hooks.rs +0 -210
- data/ext/makiri/rust/src/xpath/verify.rs +0 -133
- /data/ext/makiri/rust/{src → engine/src}/conformance/dat.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/conformance/json.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/conformance/known.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/conformance/tokens.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/conformance/tree.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/css_match/dom.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/css_match/ns.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/css_match/tree.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/dom_rules/tests.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/dom_rules.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/dom/compact.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/dom/css.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/dom/ext_table.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/dom/parsed.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/dom/xpath.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/encoding/prescan.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/mod.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/res/entities.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/res/mod.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/res/names.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/res/tree.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tokenizer/error.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tokenizer/state_comment.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tokenizer/state_doctype.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tokenizer/state_text.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/error.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/after_after_body.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/after_after_frameset.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/after_body.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/after_frameset.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/after_head.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/before_head.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/before_html.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_caption.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_cell.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_column_group.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_head.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_head_noscript.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_row.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_table.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_table_body.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/in_template.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/initial.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/mod.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/modes/text.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/html/tree/stamp.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/node_type.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/selectors/rules.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/selectors/strtod.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/css.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/encoding_names.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/mutate/edit.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/mutate/factory.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/ns_scope.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/qname.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/tree/cursor.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/tree/decl.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xml/xpath.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xpath/ast_ops.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xpath/axis.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xpath/funcs/ext.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xpath/lex.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xpath/nodetest.rs +0 -0
- /data/ext/makiri/rust/{src → engine/src}/xpath/step_index.rs +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 817ebc4a3638f89ae3a9eff5832fef31ea14af87b1a7ed121580288e3519570c
|
|
4
|
+
data.tar.gz: 3179b5c9f5789d013b0413b77feae8511e60f6f120677fb7b48d216685d0ffe5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e88ab896e1e032fc7f0dd2bbb61dc13f0374e40fb63c28db864714848af3773d87793a8be8c80a221f2814477c6f002fa702c4c72fb525c7726984e6a8a75018
|
|
7
|
+
data.tar.gz: 206c21e9751cfad6fdf44152d077549a62cd4104f4c3eab0274ae83f6dbb37120c3662fe47e1cd2803c51a8f5db3748cc3b636b651623811ae3d9eee12105183
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [0.17.0] - 2026-11-26
|
|
4
|
+
|
|
5
|
+
The same code as 0.17.0.rc3. What changed since 0.16.0 is in the
|
|
6
|
+
0.17.0.rc1, rc2 and rc3 entries below.
|
|
7
|
+
|
|
8
|
+
## [0.17.0.rc3] - 2026-11-08
|
|
9
|
+
|
|
10
|
+
### Security
|
|
11
|
+
|
|
12
|
+
* An HTML parse stops with `Makiri::Error` ("document size limit
|
|
13
|
+
exceeded") once the document it builds passes `max_amplification:` times
|
|
14
|
+
its input (default 256, never less than 64 MiB), so a crafted input can no
|
|
15
|
+
longer build a document far larger than itself; ordinary documents build
|
|
16
|
+
10-50 times theirs. The keyword is taken by `Makiri::HTML`,
|
|
17
|
+
`Document#fragment` and `DocumentFragment.parse`, and a negative value
|
|
18
|
+
lifts the limit. `inner_html=` and `outer_html=` use the default.
|
|
19
|
+
* A selector, an XPath expression, a name or text is checked to be UTF-8 by
|
|
20
|
+
Makiri itself, on its own copy of the bytes, rather than trusted on the
|
|
21
|
+
String's cached coderange, which another C extension could leave wrong.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
* Makiri can be used outside the main Ractor. Each Ractor parses, queries,
|
|
26
|
+
edits and writes its own documents, in parallel with the others: XPath,
|
|
27
|
+
which holds the GVL and so does not scale across threads, scales across
|
|
28
|
+
Ractors. A Document, a node, a NodeSet or an XPathContext cannot be
|
|
29
|
+
shared with, copied to or moved to another Ractor.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
* A source install needs Rust 1.95 or newer (it was 1.84). Binary gems
|
|
34
|
+
need no toolchain.
|
|
35
|
+
* An unknown keyword is `ArgumentError` in `DocumentFragment.parse`,
|
|
36
|
+
`Document#fragment`, `to_html`, `inner_html`, `outer_html`, `to_xml` and
|
|
37
|
+
`canonicalize`, as it already was in `Makiri::HTML` and `Makiri::XML`;
|
|
38
|
+
a misspelt one was ignored. `#xpath`, `#at_xpath` and `XPathContext.new`
|
|
39
|
+
read their other keywords as namespace bindings, as before.
|
|
40
|
+
* HTML `to_html`, `to_s`, `outer_html` and `inner_html` take `encoding:`
|
|
41
|
+
naming UTF-8 (a String, a Symbol or an `Encoding`), which code written
|
|
42
|
+
for Nokogiri passes, and refuse any other with `ArgumentError`: HTML is
|
|
43
|
+
written as UTF-8 alone. `NodeSet#to_html` passes its keywords to each
|
|
44
|
+
node's.
|
|
45
|
+
* An exception message is at most 256 bytes; one quoting a longer selector,
|
|
46
|
+
expression or name ends in `...`.
|
|
47
|
+
* `XPathContext#node=`, `#register_namespace(s)` and `#register_variable(s)`
|
|
48
|
+
on a frozen context raise `FrozenError`.
|
|
49
|
+
* A namespace binding given as a keyword (`doc.xpath(expr, k => uri)`) must
|
|
50
|
+
have a Symbol or plain String key; a String subclass raises `TypeError`.
|
|
51
|
+
`XPathContext#register_namespaces` takes a Hash alone; anything else is
|
|
52
|
+
`TypeError`.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
* `Node#search` and `#at` read a string as XPath when it names an axis
|
|
57
|
+
(`ancestor::div`) outside a quoted string, not for any `::`: a selector
|
|
58
|
+
with `::` in an attribute value (`a[title='a::b']`) answered nothing, and
|
|
59
|
+
one with a pseudo-element (`p::before`) raised
|
|
60
|
+
`Makiri::XPath::SyntaxError`.
|
|
61
|
+
* `Makiri::XML`'s `#css`, `#at_css` and `#matches?` take a selector as
|
|
62
|
+
`Makiri::HTML`'s do, a `String` or a `Symbol`, anything else a
|
|
63
|
+
`TypeError`. They called `to_s` on it, so `nil` raised
|
|
64
|
+
`Makiri::CSS::SyntaxError` and `1` was the selector `"1"`.
|
|
65
|
+
* A fragment's String `context:` naming no built-in tag (`"my-el"`) is
|
|
66
|
+
`ArgumentError` in every document; `Document#fragment` took one when the
|
|
67
|
+
document already held such an element. `"SVG"` and `"MATH"` name the SVG
|
|
68
|
+
and MathML roots in any case, as an HTML tag does; only the lower-case
|
|
69
|
+
names did.
|
|
70
|
+
* Inserting a fragment one of whose children is frozen raises
|
|
71
|
+
`FrozenError`, as inserting a frozen node does, in HTML and XML, and
|
|
72
|
+
inserts nothing.
|
|
73
|
+
* An XML Document reports what its factories (`create_element`,
|
|
74
|
+
`create_text_node`, `clone_node`, ...) grow it by to the GC, as an HTML
|
|
75
|
+
one does, so a loop that only makes nodes is collected on memory pressure.
|
|
76
|
+
* An XML document that begins with a UTF-16 byte order mark and declares
|
|
77
|
+
`encoding="UTF-16"`, as XML 1.0 writes one, parses (UTF-32's too), and so
|
|
78
|
+
does `to_xml(encoding: "UTF-16")`'s output; both raised
|
|
79
|
+
`Makiri::XML::SyntaxError`.
|
|
80
|
+
* An XML document declaring `encoding="US-ASCII"` that holds a character
|
|
81
|
+
past ASCII raises `Makiri::XML::SyntaxError`, a UTF-8 String or a byte
|
|
82
|
+
order mark included; the character was read.
|
|
83
|
+
* XML `to_xml(encoding: "US-ASCII")` writes a character past ASCII as a
|
|
84
|
+
character reference, in a US-ASCII String. It wrote the UTF-8 bytes
|
|
85
|
+
under the US-ASCII declaration, which `Makiri::XML` then refused.
|
|
86
|
+
* `to_xml(encoding:)` naming an encoding other than UTF-8 raises
|
|
87
|
+
`Makiri::Error` when an element or attribute name, a doctype, a comment,
|
|
88
|
+
a CDATA section or a processing instruction holds a character the
|
|
89
|
+
encoding has no form for. A character reference is markup only in text
|
|
90
|
+
and attribute values; written elsewhere, it made a name ill-formed and
|
|
91
|
+
changed a comment's text.
|
|
4
92
|
|
|
5
93
|
## [0.17.0.rc2] - 2026-10-24
|
|
6
94
|
|
data/NOKOGIRI_DIFFERENCES.md
CHANGED
|
@@ -50,11 +50,36 @@ what browsers do - rather than libxml2. Detailed, test-backed notes live in
|
|
|
50
50
|
* An index is an `Integer`: `node_set[1.5]` and a Range with a Float end
|
|
51
51
|
are a `TypeError`, where Nokogiri (as `Array#[]`) truncates them.
|
|
52
52
|
|
|
53
|
+
* Namespace bindings: a Hash key is read as a prefix, with only `xmlns:` taken off
|
|
54
|
+
* `xpath(expr, ns)`, `css(rule, ns)` and `XPathContext#register_namespaces`
|
|
55
|
+
bind `p` for a key `"xmlns:p"`, so the Hash `Node#namespaces` returns can
|
|
56
|
+
be passed as it is, as in Nokogiri. Nokogiri takes off everything up to the
|
|
57
|
+
last `:` of any key (`"xml:p"`, `"a:b:p"` bind `p`); Makiri reads any other
|
|
58
|
+
key as the prefix itself.
|
|
59
|
+
* Keys and values are not converted: a key is a `String` or a `Symbol`, a URI
|
|
60
|
+
a `String`, and anything else is a `TypeError`. Nokogiri's
|
|
61
|
+
`register_namespaces` and `register_variables` call `to_s` on each key, so
|
|
62
|
+
an Integer key binds `"1"` there.
|
|
63
|
+
* `register_namespace` with a single prefix takes `"xmlns:p"` as it is, in
|
|
64
|
+
both.
|
|
65
|
+
|
|
66
|
+
* `Node#search` / `#at` send more strings to XPath
|
|
67
|
+
* Both treat a string that starts with `/`, `./` or `..`, or is `.` alone,
|
|
68
|
+
as XPath. Makiri also treats one that starts with `(` or `@`, or names an
|
|
69
|
+
axis outside a quoted string, as XPath (`(//a)[1]`, `@href`, `child::p`);
|
|
70
|
+
a CSS pseudo-element (`p::before`) or a `::` in an attribute value stays
|
|
71
|
+
CSS. Nokogiri sends those to its CSS translator, which raises
|
|
72
|
+
`CSS::SyntaxError` for `(//a)[1]` and `child::p`; `@href` happens to come
|
|
73
|
+
out as the same attribute search.
|
|
74
|
+
|
|
53
75
|
* There are no custom XPath functions
|
|
54
76
|
* Nokogiri answers a function XPath does not define by calling a method of
|
|
55
77
|
a handler object (`xpath("my-fn(.)", handler)`). Makiri runs no Ruby while
|
|
56
78
|
it evaluates: a call to a function XPath 1.0 does not define is an
|
|
57
|
-
`XPath::SyntaxError`, and a handler argument is an `ArgumentError`.
|
|
79
|
+
`XPath::SyntaxError`, and a handler argument is an `ArgumentError`. The
|
|
80
|
+
exception is Nokogiri's own builtins, `css-class` and `local-name-is`,
|
|
81
|
+
which answer under a prefix bound to Nokogiri's builtin namespace
|
|
82
|
+
(`https://www.nokogiri.org/default_ns/ruby/builtins`).
|
|
58
83
|
|
|
59
84
|
* A number literal is read as the nearest double; libxml2's own reader is not
|
|
60
85
|
correctly rounded for a literal with more digits than a double holds, so
|
|
@@ -224,7 +249,7 @@ what browsers do - rather than libxml2. Detailed, test-backed notes live in
|
|
|
224
249
|
not: its parsed contents live in the separate fragment `Element#content_fragment`
|
|
225
250
|
returns, `template.children` is empty, and `inner_html` / `inner_html=`
|
|
226
251
|
special-case the contents (the WHATWG DOM special-cases `innerHTML` alone;
|
|
227
|
-
`
|
|
252
|
+
`add_child`, `content=`, and `children` act on the element's own empty
|
|
228
253
|
children, as the specification says). Nokogiri treats `<template>` as an
|
|
229
254
|
ordinary element, with the parsed nodes as its children, so
|
|
230
255
|
`template.inner_html` and `template.children` answer the other way round and
|
|
@@ -306,8 +331,10 @@ what browsers do - rather than libxml2. Detailed, test-backed notes live in
|
|
|
306
331
|
`div`, since the selector is matched against the whole tree and only the
|
|
307
332
|
results are kept to descendants. `Nokogiri::HTML5` and `Nokogiri::XML` scope
|
|
308
333
|
the selector to the node (`#c` cannot be the `div`), and so did
|
|
309
|
-
`Makiri::XML` up to 0.16.
|
|
310
|
-
|
|
334
|
+
`Makiri::XML` up to 0.16. `:scope` is the node the query is made from, as in
|
|
335
|
+
a browser (`at_css("#c").css(":scope > p")`, and the document element when
|
|
336
|
+
the query is made from a document), for a match scoped to it; XPath from the
|
|
337
|
+
node (`xpath(".//div//p")`) is the other way.
|
|
311
338
|
* The attribute case modifiers (`[a="x" i]`, `[a="x" s]`) are supported on
|
|
312
339
|
both representations. Nokogiri refuses both on either.
|
|
313
340
|
* The form-state and link pseudo-classes (`:checked`, `:disabled`,
|
|
@@ -348,8 +375,8 @@ what browsers do - rather than libxml2. Detailed, test-backed notes live in
|
|
|
348
375
|
disabled (its children are elements, not raw text) and escaping is what makes
|
|
349
376
|
that round-trip; `Nokogiri::HTML5` writes it literally and contradicts its own
|
|
350
377
|
parser there.
|
|
351
|
-
* An Attr serializes to the empty string (`attr.to_s`,
|
|
352
|
-
|
|
378
|
+
* An Attr serializes to the empty string (`attr.to_s`, `NodeSet#to_s` over
|
|
379
|
+
attributes, and in HTML `#to_html`), as DOM Parsing's algorithm and Firefox
|
|
353
380
|
have it, in HTML and XML. Nokogiri's `Attr#to_s` is the value (`"a"`) and
|
|
354
381
|
its `#to_html` the markup (`id="a"`); use `#value` for the value.
|
|
355
382
|
|
data/README.md
CHANGED
|
@@ -33,7 +33,9 @@ dependency.
|
|
|
33
33
|
differential, and property-based testing vs Nokogiri (see below).
|
|
34
34
|
* Bounded, fail-closed execution
|
|
35
35
|
* XPath evaluation is bounded by per-evaluation limits on work, memory, and recursion.
|
|
36
|
-
* HTML parsing bounds the tree depth (`max_tree_depth:`, default 400)
|
|
36
|
+
* HTML parsing bounds the tree depth (`max_tree_depth:`, default 400) and the
|
|
37
|
+
size of the document it builds against its input (`max_amplification:`,
|
|
38
|
+
default 256 times, never less than 64 MiB).
|
|
37
39
|
* Ownership and borrowing are kept explicit across layers, with owned/borrowed
|
|
38
40
|
string types and verified text at engine boundaries.
|
|
39
41
|
* Programmatic invalid input, limit violations, allocation failures, and unsupported constructs
|
|
@@ -80,6 +82,11 @@ Makiri::HTML(bytes, encoding: "euc-jp")
|
|
|
80
82
|
# max_tree_depth: raises the limit, and a negative value disables it
|
|
81
83
|
Makiri::HTML(deep_html, max_tree_depth: 2000)
|
|
82
84
|
|
|
85
|
+
# A short input cannot build an enormous document: more than 256 times the
|
|
86
|
+
# input (and 64 MiB) raises Makiri::Error; max_amplification: changes the ratio,
|
|
87
|
+
# and a negative value disables it
|
|
88
|
+
Makiri::HTML(html, max_amplification: 1024)
|
|
89
|
+
|
|
83
90
|
# Serialization
|
|
84
91
|
doc.at_css("#main").to_html # => "<div id=\"main\" ...>...</div>"
|
|
85
92
|
doc.at_css("#main").inner_html # => "\n <p class=\"lead\">Hello</p>\n..."
|
|
@@ -217,9 +224,9 @@ doc.at_css("p").instance_variable_get(:@wrapper) # => the same MyElement
|
|
|
217
224
|
```
|
|
218
225
|
|
|
219
226
|
A node created by `clone_node` or `import_node` is a new node with no state.
|
|
220
|
-
`pointer_id`
|
|
221
|
-
|
|
222
|
-
document, not across documents.
|
|
227
|
+
`pointer_id` tells the nodes of one document apart, not documents: a node of
|
|
228
|
+
another document may have the same value, an HTML node and an XML node
|
|
229
|
+
especially. So key a pointer-based cache per document, not across documents.
|
|
223
230
|
|
|
224
231
|
## Non-goals (v1.0)
|
|
225
232
|
|
|
@@ -270,7 +277,7 @@ See also [`spec/conformance/README.md`](spec/conformance/README.md).
|
|
|
270
277
|
## Requirements
|
|
271
278
|
|
|
272
279
|
* CRuby 3.3 or newer.
|
|
273
|
-
* Rust 1.
|
|
280
|
+
* Rust 1.95 or newer with `cargo` - the extension is a Rust crate. (Binary
|
|
274
281
|
gems are published for the common platforms, which need no toolchain.)
|
|
275
282
|
* libclang (clang's development library): rb-sys runs bindgen at build time and
|
|
276
283
|
reads Ruby's headers through it.
|
data/ext/makiri/rust/Cargo.lock
CHANGED
|
@@ -21,8 +21,6 @@ dependencies = [
|
|
|
21
21
|
"cexpr",
|
|
22
22
|
"clang-sys",
|
|
23
23
|
"itertools",
|
|
24
|
-
"log",
|
|
25
|
-
"prettyplease",
|
|
26
24
|
"proc-macro2",
|
|
27
25
|
"quote",
|
|
28
26
|
"regex",
|
|
@@ -89,6 +87,10 @@ dependencies = [
|
|
|
89
87
|
"cfg-if",
|
|
90
88
|
]
|
|
91
89
|
|
|
90
|
+
[[package]]
|
|
91
|
+
name = "falloc"
|
|
92
|
+
version = "0.0.1"
|
|
93
|
+
|
|
92
94
|
[[package]]
|
|
93
95
|
name = "glob"
|
|
94
96
|
version = "0.3.4"
|
|
@@ -127,43 +129,21 @@ dependencies = [
|
|
|
127
129
|
]
|
|
128
130
|
|
|
129
131
|
[[package]]
|
|
130
|
-
name = "
|
|
131
|
-
version = "0.
|
|
132
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
133
|
-
checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
|
134
|
-
|
|
135
|
-
[[package]]
|
|
136
|
-
name = "magnus"
|
|
137
|
-
version = "0.8.2"
|
|
138
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
139
|
-
checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
|
|
140
|
-
dependencies = [
|
|
141
|
-
"magnus-macros",
|
|
142
|
-
"rb-sys",
|
|
143
|
-
"rb-sys-env",
|
|
144
|
-
"seq-macro",
|
|
145
|
-
]
|
|
146
|
-
|
|
147
|
-
[[package]]
|
|
148
|
-
name = "magnus-macros"
|
|
149
|
-
version = "0.8.0"
|
|
150
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
151
|
-
checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
|
|
132
|
+
name = "makiri_engine"
|
|
133
|
+
version = "0.0.1"
|
|
152
134
|
dependencies = [
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
135
|
+
"chardetng",
|
|
136
|
+
"encoding_rs",
|
|
137
|
+
"falloc",
|
|
156
138
|
]
|
|
157
139
|
|
|
158
140
|
[[package]]
|
|
159
141
|
name = "makiri_rs"
|
|
160
142
|
version = "0.0.1"
|
|
161
143
|
dependencies = [
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"magnus",
|
|
166
|
-
"rb-sys",
|
|
144
|
+
"falloc",
|
|
145
|
+
"makiri_engine",
|
|
146
|
+
"nupur",
|
|
167
147
|
]
|
|
168
148
|
|
|
169
149
|
[[package]]
|
|
@@ -189,13 +169,17 @@ dependencies = [
|
|
|
189
169
|
]
|
|
190
170
|
|
|
191
171
|
[[package]]
|
|
192
|
-
name = "
|
|
193
|
-
version = "0.
|
|
194
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
195
|
-
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
|
172
|
+
name = "nupur"
|
|
173
|
+
version = "0.0.1"
|
|
196
174
|
dependencies = [
|
|
197
|
-
"
|
|
198
|
-
|
|
175
|
+
"nupur_sys",
|
|
176
|
+
]
|
|
177
|
+
|
|
178
|
+
[[package]]
|
|
179
|
+
name = "nupur_sys"
|
|
180
|
+
version = "0.0.1"
|
|
181
|
+
dependencies = [
|
|
182
|
+
"rb-sys",
|
|
199
183
|
]
|
|
200
184
|
|
|
201
185
|
[[package]]
|
|
@@ -240,12 +224,6 @@ dependencies = [
|
|
|
240
224
|
"syn",
|
|
241
225
|
]
|
|
242
226
|
|
|
243
|
-
[[package]]
|
|
244
|
-
name = "rb-sys-env"
|
|
245
|
-
version = "0.2.3"
|
|
246
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
-
checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
248
|
-
|
|
249
227
|
[[package]]
|
|
250
228
|
name = "regex"
|
|
251
229
|
version = "1.13.1"
|
|
@@ -281,12 +259,6 @@ version = "2.1.3"
|
|
|
281
259
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
282
260
|
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
283
261
|
|
|
284
|
-
[[package]]
|
|
285
|
-
name = "seq-macro"
|
|
286
|
-
version = "0.3.6"
|
|
287
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
288
|
-
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
289
|
-
|
|
290
262
|
[[package]]
|
|
291
263
|
name = "shell-words"
|
|
292
264
|
version = "1.1.1"
|
data/ext/makiri/rust/Cargo.toml
CHANGED
|
@@ -4,9 +4,9 @@ version = "0.0.1"
|
|
|
4
4
|
edition = "2021"
|
|
5
5
|
# The oldest Rust a source install builds with - what the release's
|
|
6
6
|
# `source-gem-install` job installs and builds on, so the declaration is
|
|
7
|
-
# tested. It is today's floor (1.
|
|
7
|
+
# tested. It is today's floor (1.95 brought `if let` guards in a `match`),
|
|
8
8
|
# not a promise: raise it whenever a newer feature is worth having.
|
|
9
|
-
rust-version = "1.
|
|
9
|
+
rust-version = "1.95"
|
|
10
10
|
publish = false
|
|
11
11
|
description = "The Makiri gem's extension: HTML5 parsing, XPath 1.0 and an XML reader"
|
|
12
12
|
|
|
@@ -14,28 +14,38 @@ description = "The Makiri gem's extension: HTML5 parsing, XPath 1.0 and an XML r
|
|
|
14
14
|
# The Ruby extension is `makiri.bundle` / `makiri.so`, loaded by
|
|
15
15
|
# `require "makiri/makiri"`, and rb_sys's generated Makefile copies
|
|
16
16
|
# `lib<lib name>.<soext>` into place - so the LIB name has to be `makiri` even
|
|
17
|
-
# though the package is `makiri_rs`. (The package keeps the `_rs` suffix: it
|
|
18
|
-
#
|
|
19
|
-
# the gem in cargo output.)
|
|
17
|
+
# though the package is `makiri_rs`. (The package keeps the `_rs` suffix: it
|
|
18
|
+
# distinguishes the crate from the gem in cargo output.)
|
|
20
19
|
name = "makiri"
|
|
21
|
-
# cdylib is what Ruby loads
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
crate-type = ["cdylib"
|
|
20
|
+
# cdylib is what Ruby loads, and all it is: the cargo-fuzz crate depends on
|
|
21
|
+
# the Lexbor reference alone (as `makiri`), not on this, and with an `rlib`
|
|
22
|
+
# beside it rustc would run no LTO.
|
|
23
|
+
crate-type = ["cdylib"]
|
|
25
24
|
path = "src/lib.rs"
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[
|
|
31
|
-
|
|
26
|
+
[lints]
|
|
27
|
+
workspace = true
|
|
28
|
+
|
|
29
|
+
[workspace]
|
|
30
|
+
# The extension, the engine and the fallible allocation it allocates through,
|
|
31
|
+
# and the binding layer the extension is built on. `reference/` (the Lexbor
|
|
32
|
+
# reference, with its vendored C library and bindgen), `fuzz/` (cargo-fuzz's
|
|
33
|
+
# own nightly crate) and `lints/` (the two dylint libraries, on their pinned
|
|
34
|
+
# nightly) are workspaces of their own, run from their directories - so this
|
|
35
|
+
# workspace's Cargo.lock, the one a source install builds from, holds nothing
|
|
36
|
+
# of Lexbor's, and no build script here reads a Lexbor header.
|
|
37
|
+
members = [".", "nupur", "nupur/sys", "engine", "falloc"]
|
|
38
|
+
exclude = ["fuzz", "lints", "reference"]
|
|
39
|
+
|
|
40
|
+
[workspace.lints.rust]
|
|
41
|
+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)', 'cfg(makiri_lint_probe)', 'cfg(makiri_no_unwind)', 'cfg(nupur_lint_probe)', 'cfg(nupur_sys_lint_probe)', 'cfg(nupur_no_unwind)', 'cfg(dylint_lib, values(any()))'] }
|
|
32
42
|
|
|
33
43
|
# The panic gate. A panic now reaches Ruby as an exception (see the profile
|
|
34
44
|
# below), but it is still an INTERNAL error nobody asked for - `rescue => e`
|
|
35
|
-
# does not catch a `
|
|
36
|
-
# accident: these
|
|
37
|
-
# few sites that want one carry an `#[allow]` with a
|
|
38
|
-
# exempt in `lib.rs`.
|
|
45
|
+
# does not catch a `Makiri::InternalError` - so a new one has to be a decision
|
|
46
|
+
# rather than an accident: these three make it a build failure under CI's
|
|
47
|
+
# `-D warnings`, and the few sites that want one carry an `#[allow]` with a
|
|
48
|
+
# reason. Test code is exempt in `lib.rs`.
|
|
39
49
|
#
|
|
40
50
|
# `expect_used` joined them once method registration stopped `.expect`ing each
|
|
41
51
|
# definition (223 hits, now `?`): what remains is a handful of invariants, each
|
|
@@ -43,100 +53,49 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)', 'cfg(fuzzing)', 'c
|
|
|
43
53
|
# engine's own bounds-checked walks): gating those needs a different argument
|
|
44
54
|
# than "a panic aborts", since release builds keep `overflow-checks` on
|
|
45
55
|
# precisely so a wrapped size stops the process instead of answering wrong.
|
|
46
|
-
[lints.clippy]
|
|
56
|
+
[workspace.lints.clippy]
|
|
47
57
|
unwrap_used = "warn"
|
|
48
58
|
expect_used = "warn"
|
|
49
59
|
panic = "warn"
|
|
50
60
|
|
|
51
61
|
[features]
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
# references, and the last, `html-dom`, the HTML DOM and everything over it
|
|
56
|
-
# (below).
|
|
57
|
-
#
|
|
58
|
-
# The port's thirty-seven per-file flags are gone. They existed so one C file at
|
|
59
|
-
# a time could be replaced behind an identical ABI; there is no C left to
|
|
60
|
-
# replace, so a flag per former file only described history.
|
|
61
|
-
default = ["ruby"]
|
|
62
|
-
|
|
63
|
-
# The Ruby boundary: magnus, rb-sys, and everything under `bridge/`, `glue/`
|
|
64
|
-
# and `init.rs`. Off, the crate is the engine alone - which is what Kani and
|
|
65
|
-
# cargo-fuzz build, since neither can link a live Ruby. It needs no Lexbor:
|
|
66
|
-
# its HTML DOM is the arena's (`html-dom`).
|
|
67
|
-
ruby = ["dep:magnus", "dep:rb-sys", "html-dom"]
|
|
68
|
-
|
|
69
|
-
# The vendored Lexbor: build.rs runs bindgen over its headers, so this also
|
|
70
|
-
# decides whether a build needs `vendor/lexbor/dist` to exist at all. `rake
|
|
71
|
-
# kani` turns it OFF deliberately - the proofs are over the XML reader and the
|
|
72
|
-
# XPath front end, and not needing a Lexbor build is what lets them run without
|
|
73
|
-
# `rake compile` first. Lexbor is only ever the reference the ports are
|
|
74
|
-
# tested against; the HTML DOM beside it is still the arena's.
|
|
75
|
-
lexbor = ["html-dom"]
|
|
62
|
+
# The extension is the Ruby surface over the engine and nothing else: the
|
|
63
|
+
# engine's own features (`html-dom`, `lexbor-compat`) are the engine's, and
|
|
64
|
+
# the Lexbor references are `makiri_lexbor`'s.
|
|
76
65
|
|
|
77
|
-
# Allocation-failure injection, the Rust half of `rake oom
|
|
78
|
-
# `falloc
|
|
79
|
-
alloc-inject = []
|
|
80
|
-
|
|
81
|
-
# The OLD `lxb_selectors` engine (`lexbor::selectors`) outside `cfg(test)`, as
|
|
82
|
-
# the reference the `html_css_diff` fuzz harness holds `css_match` to. Never
|
|
83
|
-
# part of a build that ships.
|
|
84
|
-
css-reference = ["lexbor"]
|
|
85
|
-
|
|
86
|
-
# The CSS-to-XPath lowering (`crate::css`) outside `cfg(test)`, as the
|
|
87
|
-
# reference the `css` fuzz harness holds the matcher's XML instance to - the
|
|
88
|
-
# engine `Makiri::XML`'s CSS ran on before it moved to `css_match`. No
|
|
89
|
-
# dependency, no Lexbor. Never part of a build that ships.
|
|
90
|
-
xml-css-reference = []
|
|
91
|
-
|
|
92
|
-
# Lexbor as the parser port's reference (`lexbor::tree_diff`): its tree,
|
|
93
|
-
# copied into the arena, beside the ported tree builder's, for the
|
|
94
|
-
# `html_diff` fuzz harness. Never part of a build that ships.
|
|
95
|
-
lexbor-reference = ["lexbor"]
|
|
96
|
-
|
|
97
|
-
# The parser port's index-arena DOM (`crate::html::dom`) behind its facade
|
|
98
|
-
# (`crate::html_dom`), parsed by the ported tree builder (`crate::html::tree`),
|
|
99
|
-
# and what sits over it: the HTML CSS matcher, XPath's HTML instance, the
|
|
100
|
-
# bridge's HTML half. Off only in the bare engine (Kani). `ruby` and `lexbor`
|
|
101
|
-
# both turn it on. The document parse's encoding sniffing and decoders
|
|
102
|
-
# (`html::encoding`) come with it.
|
|
103
|
-
html-dom = ["dep:encoding_rs", "dep:chardetng"]
|
|
66
|
+
# Allocation-failure injection, the Rust half of `rake oom`: the engine's
|
|
67
|
+
# allocations (`falloc`) and the binding layer's raising calls.
|
|
68
|
+
alloc-inject = ["makiri_engine/alloc-inject", "falloc/alloc-inject", "nupur/alloc-inject"]
|
|
104
69
|
|
|
105
70
|
[dependencies]
|
|
106
|
-
# The
|
|
107
|
-
#
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
#
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
# what lets Kani and cargo-fuzz compile it. `rb-sys` is magnus's own binding
|
|
115
|
-
# layer, taken directly for the raw VALUEs the boundary passes around and
|
|
116
|
-
# deliberately WITHOUT `link-ruby`: the extension is dlopen'd into a Ruby that
|
|
117
|
-
# already provides the rb_* symbols.
|
|
118
|
-
magnus = { version = "0.8", features = ["rb-sys"], optional = true }
|
|
119
|
-
rb-sys = { version = "0.9", optional = true }
|
|
71
|
+
# The engine: the HTML parser and DOM, the XML reader, XPath and CSS - no
|
|
72
|
+
# Ruby, no Lexbor (`engine/`).
|
|
73
|
+
makiri_engine = { path = "engine", version = "0.0.1" }
|
|
74
|
+
falloc = { path = "falloc", version = "0.0.1" }
|
|
75
|
+
# `nupur` is the binding layer (`nupur/`): every `unsafe` that talks to Ruby,
|
|
76
|
+
# behind safe types - the one layer between the glue and Ruby. rb-sys comes with it,
|
|
77
|
+
# through `nupur_sys` (`nupur/sys/`) alone; neither this crate nor `nupur` names it.
|
|
78
|
+
nupur = { path = "nupur", version = "0.0.1" }
|
|
120
79
|
|
|
121
80
|
# `unwind`, so a panic reaches Ruby as an exception instead of killing the host
|
|
122
|
-
# process.
|
|
123
|
-
#
|
|
124
|
-
# `
|
|
125
|
-
#
|
|
126
|
-
#
|
|
81
|
+
# process. Every method's trampoline (`bridge::rb::method::finish`) catches a
|
|
82
|
+
# panic; `abort` would stop such a catch from ever running. With `unwind` a
|
|
83
|
+
# panic becomes `Makiri::InternalError` - an `Exception`, not a
|
|
84
|
+
# `StandardError`, so not caught by `rescue => e` but by `rescue Exception` -
|
|
85
|
+
# and it runs `ensure` blocks, `at_exit` and every destructor on the way out,
|
|
86
|
+
# none of which `abort` runs.
|
|
127
87
|
#
|
|
128
88
|
# A callback is the case this does not cover by itself: Rust turns an unwind at
|
|
129
89
|
# an `extern "C"` boundary into an abort, because unwinding through C frames
|
|
130
90
|
# built without unwind tables is undefined behaviour. So every callback catches
|
|
131
91
|
# its own panic and the caller re-raises it past the C frames - `caught::
|
|
132
|
-
# PanicLatch`, installed in
|
|
133
|
-
#
|
|
134
|
-
#
|
|
135
|
-
#
|
|
92
|
+
# PanicLatch`, installed in the two the shipped build has (`bridge::gvl`'s
|
|
93
|
+
# trampoline and `nupur::raw::hash_foreach`'s callback). The GC callbacks in
|
|
94
|
+
# `nupur/src/typed/callbacks.rs` have no latch on purpose; see
|
|
95
|
+
# docs/internals/ruby_boundary.md.
|
|
136
96
|
#
|
|
137
97
|
# Anything that must be released across a panic is therefore a `Drop`, not a
|
|
138
|
-
# statement after the work.
|
|
139
|
-
# `post_parse::DocOwner` are the two that had to be converted.
|
|
98
|
+
# statement after the work.
|
|
140
99
|
#
|
|
141
100
|
# overflow-checks stays ON in release: a wrapped size is exactly the class of
|
|
142
101
|
# bug fail-closed exists to stop, and now it stops as an exception.
|
|
@@ -150,8 +109,3 @@ debug = false
|
|
|
150
109
|
|
|
151
110
|
[profile.dev]
|
|
152
111
|
panic = "unwind"
|
|
153
|
-
|
|
154
|
-
[build-dependencies]
|
|
155
|
-
# Reads the vendored Lexbor headers so the layout is not transcribed by hand.
|
|
156
|
-
# libclang is already required by rb-sys, so this adds no new system dependency.
|
|
157
|
-
bindgen = "0.72"
|