diff --git a/DEPS b/DEPS index 2f354986e80e..a92258fb0787 100644 --- a/DEPS +++ b/DEPS @@ -38,7 +38,7 @@ deps = { "third_party/rust/star_constellation/v0_2/crate": "https://github.com/brave/constellation.git@db575edec12509ce1bda6afe68bb58e538a21d3a", "third_party/rust/challenge_bypass_ristretto/v1/crate": "https://github.com/brave-intl/challenge-bypass-ristretto.git@a1da4641734adc8312215b38a8221962d2c8e045", "third_party/rust/futures_retry/v0_5/crate": "https://github.com/brave-intl/futures-retry.git@2aaaafbc3d394661534d4dbd14159d164243c20e", - "third_party/rust/kuchiki/v0_8/crate": "https://github.com/brave/kuchiki.git@589eadca2c1d06ddda2919354590bfe1ace88a43", + "third_party/rust/kuchikiki/v0_8/crate": "https://github.com/brave/kuchiki.git@436b4e21274e64c5f9bc142ba6fa330fe9a8c97d", "third_party/macholib": { "url": "https://github.com/ronaldoussoren/macholib.git@36a6777ccd0891c5d1b44ba885573d7c90740015", "condition": "checkout_mac", diff --git a/components/speedreader/rust/ffi/Cargo.toml b/components/speedreader/rust/ffi/Cargo.toml index 33e2e217a5e8..3f0f84461882 100644 --- a/components/speedreader/rust/ffi/Cargo.toml +++ b/components/speedreader/rust/ffi/Cargo.toml @@ -16,5 +16,5 @@ name = "speedreader_ffi" path = "lib.rs" crate-type = ["rlib"] -[patch.crates-io.kuchiki] -path = "../../../../third_party/rust/kuchiki/v0_8/crate" +[patch.crates-io.kuchikiki] +path = "../../../../third_party/rust/kuchikiki/v0_8/crate" diff --git a/components/speedreader/rust/lib/BUILD.gn b/components/speedreader/rust/lib/BUILD.gn index c6a37877b19d..4654fa7eccdf 100644 --- a/components/speedreader/rust/lib/BUILD.gn +++ b/components/speedreader/rust/lib/BUILD.gn @@ -18,7 +18,7 @@ rust_static_library("lib") { deps = [ "src/readability:lib", "//brave/third_party/rust/html5ever/v0_25:lib", - "//brave/third_party/rust/kuchiki/v0_8:lib", + "//brave/third_party/rust/kuchikiki/v0_8:lib", "//brave/third_party/rust/lifeguard/v0_6:lib", "//brave/third_party/rust/lol_html/v0_3:lib", "//brave/third_party/rust/markup5ever/v0_10:lib", diff --git a/components/speedreader/rust/lib/Cargo.toml b/components/speedreader/rust/lib/Cargo.toml index c74673cc303f..5830506268f9 100644 --- a/components/speedreader/rust/lib/Cargo.toml +++ b/components/speedreader/rust/lib/Cargo.toml @@ -18,7 +18,7 @@ include = [ [dependencies] html5ever = "0.25.1" -kuchiki = "0.8.1" +kuchikiki = "0.8.2" lol_html = "0.3.0" regex = "1" serde_json = "1.0.70" @@ -44,6 +44,5 @@ criterion = "0.3" futures = "0.3" tokio = { version = "1.2", features = ["full"] } -[patch.crates-io.kuchiki_v0_8] -path = "../../../../third_party/rust/kuchiki/v0_8/crate" -package = "kuchiki" +[patch.crates-io.kuchikiki] +path = "../../../../third_party/rust/kuchikiki/v0_8/crate" diff --git a/components/speedreader/rust/lib/src/readability/BUILD.gn b/components/speedreader/rust/lib/src/readability/BUILD.gn index bb216a125173..c2e0fa36daa3 100644 --- a/components/speedreader/rust/lib/src/readability/BUILD.gn +++ b/components/speedreader/rust/lib/src/readability/BUILD.gn @@ -23,7 +23,7 @@ rust_static_library("lib") { deps = [ "//brave/third_party/rust/html5ever/v0_25:lib", - "//brave/third_party/rust/kuchiki/v0_8:lib", + "//brave/third_party/rust/kuchikiki/v0_8:lib", "//brave/third_party/rust/thiserror/v1:lib", "//brave/third_party/rust/time/v0_3:lib", "//brave/third_party/rust/url/v2:lib", diff --git a/components/speedreader/rust/lib/src/readability/Cargo.toml b/components/speedreader/rust/lib/src/readability/Cargo.toml index 75c10b9789af..fa26397c1763 100644 --- a/components/speedreader/rust/lib/src/readability/Cargo.toml +++ b/components/speedreader/rust/lib/src/readability/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" [dependencies] bitflags = "1.2" html5ever = "0.25.1" -kuchiki = "0.8.1" +kuchikiki = "0.8.2" lazy_static = "1.4" regex = "1" serde_json = "1.0" @@ -25,6 +25,5 @@ url = "2.2" assert_approx_eq = "1.1.0" reqwest = { version = "0.11.6", features = ["blocking", "stream"] } -[patch.crates-io.kuchiki_v0_8] -path = "../../../../../third_party/rust/kuchiki/v0_8/crate" -package = "kuchiki" +[patch.crates-io.kuchiki] +path = "../../../../../third_party/rust/kuchikiki/v0_8/crate" diff --git a/components/speedreader/rust/lib/src/readability/src/dom.rs b/components/speedreader/rust/lib/src/readability/src/dom.rs index 3fd7d319a6cd..f84625d146d8 100644 --- a/components/speedreader/rust/lib/src/readability/src/dom.rs +++ b/components/speedreader/rust/lib/src/readability/src/dom.rs @@ -10,10 +10,10 @@ use html5ever::tendril::TendrilSink; use html5ever::tree_builder::{ElementFlags, NodeOrText}; use html5ever::{parse_document, ParseOpts}; use html5ever::{Attribute, LocalName, QualName}; -use kuchiki::iter::NodeIterator; -use kuchiki::NodeData::{Element, Text}; -use kuchiki::NodeRef as Handle; -use kuchiki::Sink; +use kuchikiki::iter::NodeIterator; +use kuchikiki::NodeData::{Element, Text}; +use kuchikiki::NodeRef as Handle; +use kuchikiki::Sink; use std::str::FromStr; /// A small wrapper function that creates a NodeOrText from a Text handle or an diff --git a/components/speedreader/rust/lib/src/readability/src/extractor.rs b/components/speedreader/rust/lib/src/readability/src/extractor.rs index 2e41a8e391fa..64d46e0242ba 100644 --- a/components/speedreader/rust/lib/src/readability/src/extractor.rs +++ b/components/speedreader/rust/lib/src/readability/src/extractor.rs @@ -8,8 +8,8 @@ use html5ever::parse_document; use html5ever::tendril::TendrilSink; use html5ever::tree_builder::{ElementFlags, NodeOrText, TreeSink}; use html5ever::QualName; -use kuchiki::NodeRef as Handle; -use kuchiki::Sink; +use kuchikiki::NodeRef as Handle; +use kuchikiki::Sink; use regex::Regex; use std::collections::{HashMap, HashSet}; use std::default::Default; diff --git a/components/speedreader/rust/lib/src/readability/src/lib.rs b/components/speedreader/rust/lib/src/readability/src/lib.rs index 37e8220f03a7..ef9c28682bff 100644 --- a/components/speedreader/rust/lib/src/readability/src/lib.rs +++ b/components/speedreader/rust/lib/src/readability/src/lib.rs @@ -1,6 +1,6 @@ #[macro_use] extern crate html5ever; -extern crate kuchiki; +extern crate kuchikiki; extern crate regex; extern crate url; #[macro_use] diff --git a/components/speedreader/rust/lib/src/readability/src/scorer.rs b/components/speedreader/rust/lib/src/readability/src/scorer.rs index 8c830c58df54..d62fd8cc9544 100644 --- a/components/speedreader/rust/lib/src/readability/src/scorer.rs +++ b/components/speedreader/rust/lib/src/readability/src/scorer.rs @@ -3,12 +3,12 @@ use html5ever::tendril::StrTendril; use html5ever::tree_builder::TreeSink; use html5ever::tree_builder::{ElementFlags, NodeOrText}; use html5ever::{LocalName, QualName}; -use kuchiki::iter::NodeIterator; -use kuchiki::NodeData::{ +use kuchikiki::iter::NodeIterator; +use kuchikiki::NodeData::{ Comment, Doctype, Document, DocumentFragment, Element, ProcessingInstruction, Text, }; -use kuchiki::NodeRef as Handle; -use kuchiki::{ElementData, Sink}; +use kuchikiki::NodeRef as Handle; +use kuchikiki::{ElementData, Sink}; use regex::Regex; use std::cmp::Ordering; use std::collections::{HashMap, HashSet}; diff --git a/components/speedreader/rust/lib/src/readability/src/statistics.rs b/components/speedreader/rust/lib/src/readability/src/statistics.rs index 3476809dccb4..52c6a5327999 100644 --- a/components/speedreader/rust/lib/src/readability/src/statistics.rs +++ b/components/speedreader/rust/lib/src/readability/src/statistics.rs @@ -1,7 +1,7 @@ use crate::{dom, util}; -use kuchiki::iter::NodeIterator; -use kuchiki::NodeRef as Handle; -use kuchiki::{ElementData, Sink}; +use kuchikiki::iter::NodeIterator; +use kuchikiki::NodeRef as Handle; +use kuchikiki::{ElementData, Sink}; use util::count_ignore_consecutive_whitespace; #[derive(Default)] diff --git a/components/speedreader/rust/lib/src/speedreader_readability.rs b/components/speedreader/rust/lib/src/speedreader_readability.rs index 742c52e6ef3b..16d5f355b2b5 100644 --- a/components/speedreader/rust/lib/src/speedreader_readability.rs +++ b/components/speedreader/rust/lib/src/speedreader_readability.rs @@ -1,6 +1,6 @@ use html5ever::driver::{ParseOpts, Parser}; use html5ever::tendril::{StrTendril, TendrilSink}; -use kuchiki::Sink; +use kuchikiki::Sink; use lol_html::OutputSink; use std::collections::HashMap; use url::Url; diff --git a/components/speedreader/rust/lib/tests/legacy.rs b/components/speedreader/rust/lib/tests/legacy.rs index bf0efcff3477..5b0587a4abed 100644 --- a/components/speedreader/rust/lib/tests/legacy.rs +++ b/components/speedreader/rust/lib/tests/legacy.rs @@ -19,9 +19,9 @@ use std::fs::File; use std::io::Read; use url::Url; -use kuchiki::NodeData::{Element, Text}; -use kuchiki::NodeRef as Handle; -use kuchiki::Sink; +use kuchikiki::NodeData::{Element, Text}; +use kuchikiki::NodeRef as Handle; +use kuchikiki::Sink; use regex::Regex; use std::vec::Vec; diff --git a/components/speedreader/rust/lib/tests/lib.rs b/components/speedreader/rust/lib/tests/lib.rs index 1cdabb439541..381fea68e7b2 100644 --- a/components/speedreader/rust/lib/tests/lib.rs +++ b/components/speedreader/rust/lib/tests/lib.rs @@ -13,8 +13,8 @@ use url::Url; use distance::damerau_levenshtein; use html5ever::LocalName; -use kuchiki::NodeData::{Element, Text}; -use kuchiki::NodeRef as Handle; +use kuchikiki::NodeData::{Element, Text}; +use kuchikiki::NodeRef as Handle; use std::vec::Vec; static SAMPLES_PATH: &str = "data/tests-samples/"; diff --git a/third_party/rust/Cargo.lock b/third_party/rust/Cargo.lock index 8fe756318048..469730112731 100644 --- a/third_party/rust/Cargo.lock +++ b/third_party/rust/Cargo.lock @@ -318,7 +318,7 @@ dependencies = [ "http", "iana-time-zone", "keccak", - "kuchiki", + "kuchikiki", "lazy_static", "libc", "libsecp256k1", @@ -1130,7 +1130,7 @@ dependencies = [ ] [[package]] -name = "kuchiki" +name = "kuchikiki" version = "0.8.1" dependencies = [ "cssparser 0.27.2", diff --git a/third_party/rust/Cargo.toml b/third_party/rust/Cargo.toml index 104f180e105e..256e3988e211 100644 --- a/third_party/rust/Cargo.toml +++ b/third_party/rust/Cargo.toml @@ -31,7 +31,7 @@ fvm_shared = "3" hex = "0.4" hex-literal = "0.4" hmac = "0.10" -kuchiki = "0.8" +kuchikiki = "0.8" lazy_static = "1" libc = "0.2" lifeguard = "0.6" @@ -692,9 +692,9 @@ package = "itoa" path = "keccak/v0_1/crate" package = "keccak" -[patch.crates-io.kuchiki_v0_8] -path = "kuchiki/v0_8/crate" -package = "kuchiki" +[patch.crates-io.kuchikiki_v0_8] +path = "kuchikiki/v0_8/crate" +package = "kuchikiki" [patch.crates-io.lazy_static_v1] path = "../../../third_party/rust/lazy_static/v1/crate" diff --git a/third_party/rust/kuchiki/v0_8/BUILD.gn b/third_party/rust/kuchiki/v0_8/BUILD.gn deleted file mode 100644 index 40b7c88f41f1..000000000000 --- a/third_party/rust/kuchiki/v0_8/BUILD.gn +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2023 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/rust/cargo_crate.gni") - -cargo_crate("lib") { - crate_name = "kuchiki" - epoch = "0.8" - crate_type = "rlib" - crate_root = "crate/src/lib.rs" - sources = [ - "//brave/third_party/rust/kuchiki/v0_8/crate/examples/find_matches.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/examples/stack-overflow.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/attributes.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/cell_extras.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/iter.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/lib.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/node_data_ref.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/parser.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/select.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/serializer.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/tests.rs", - "//brave/third_party/rust/kuchiki/v0_8/crate/src/tree.rs", - ] - inputs = [ "//brave/third_party/rust/kuchiki/v0_8/crate/README.md" ] - - # Unit tests skipped. Generate with --with-tests to include them. - build_native_rust_unit_tests = false - edition = "2018" - cargo_pkg_version = "0.8.1" - cargo_pkg_authors = "Simon Sapin " - cargo_pkg_name = "kuchiki" - cargo_pkg_description = "(朽木) HTML/XML tree manipulation library" - library_configs -= [ "//build/config/compiler:chromium_code" ] - library_configs += [ "//build/config/compiler:no_chromium_code" ] - executable_configs -= [ "//build/config/compiler:chromium_code" ] - executable_configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - "//brave/third_party/rust/cssparser/v0_27:lib", - "//brave/third_party/rust/html5ever/v0_25:lib", - "//brave/third_party/rust/matches/v0_1:lib", - "//brave/third_party/rust/selectors/v0_22:lib", - ] -} diff --git a/third_party/rust/kuchikiki/v0_8/BUILD.gn b/third_party/rust/kuchikiki/v0_8/BUILD.gn new file mode 100644 index 000000000000..2438072b2127 --- /dev/null +++ b/third_party/rust/kuchikiki/v0_8/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/rust/cargo_crate.gni") + +cargo_crate("lib") { + crate_name = "kuchikiki" + epoch = "0.8" + crate_type = "rlib" + crate_root = "crate/src/lib.rs" + sources = [ + "//brave/third_party/rust/kuchikiki/v0_8/crate/examples/find_matches.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/examples/stack-overflow.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/attributes.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/cell_extras.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/iter.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/lib.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/node_data_ref.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/parser.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/select.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/serializer.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/tests.rs", + "//brave/third_party/rust/kuchikiki/v0_8/crate/src/tree.rs", + ] + inputs = [ "//brave/third_party/rust/kuchikiki/v0_8/crate/README.md" ] + + # Unit tests skipped. Generate with --with-tests to include them. + build_native_rust_unit_tests = false + edition = "2018" + cargo_pkg_version = "0.8.2" + cargo_pkg_authors = "Simon Sapin " + cargo_pkg_name = "kuchikiki" + cargo_pkg_description = "(口利き) HTML tree manipulation library" + library_configs -= [ "//build/config/compiler:chromium_code" ] + library_configs += [ "//build/config/compiler:no_chromium_code" ] + executable_configs -= [ "//build/config/compiler:chromium_code" ] + executable_configs += [ "//build/config/compiler:no_chromium_code" ] + deps = [ + "//brave/third_party/rust/cssparser/v0_27:lib", + "//brave/third_party/rust/html5ever/v0_25:lib", + "//third_party/rust/indexmap/v1:lib", + "//brave/third_party/rust/matches/v0_1:lib", + "//brave/third_party/rust/selectors/v0_22:lib", + ] +} diff --git a/third_party/rust/third_party.toml b/third_party/rust/third_party.toml index 738be4eb4017..5d306138ce8f 100644 --- a/third_party/rust/third_party.toml +++ b/third_party/rust/third_party.toml @@ -63,7 +63,7 @@ skrifa = "0.4" libc = "0.2.107" # speedreader -kuchiki = "0.8.1" +kuchikiki = "0.8.1" lol_html = "0.3.0" # regex = "1" # serde_json = "1.0.70" @@ -74,7 +74,7 @@ lazy_static = "1.4" # readability bitflags = "1.2" -kuchiki = "0.8.1" +kuchikiki = "0.8.1" lazy_static = "1.4" # regex = "1" # serde_json = "1.0"