rusteerio 1.1.0 → 1.1.1

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.
package/Cargo.lock CHANGED
@@ -720,7 +720,7 @@ dependencies = [
720
720
 
721
721
  [[package]]
722
722
  name = "rusteerio"
723
- version = "1.1.0"
723
+ version = "1.1.1"
724
724
  dependencies = [
725
725
  "ego-tree",
726
726
  "html5ever",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rusteerio"
3
- version = "1.1.0"
3
+ version = "1.1.1"
4
4
  edition = "2021"
5
5
  description = "Rust HTML5 parser and CSS selector engine for the rusteerio Node.js package"
6
6
  license = "MIT"
@@ -4,7 +4,7 @@ This file preserves third-party license and attribution notices for the Rust nat
4
4
 
5
5
  Generated by `node scripts/generate-notices.mjs` from `cargo metadata --locked`, crate license files, and the pinned supplemental sources recorded in `scripts/notices/sources.json`. It includes build dependencies and dependencies for all target platforms; a particular binary may use a subset. Identical notice texts are reproduced once and referenced below. The html5ever, markup5ever and html5gum crates contain local observer-hook and opt-in UTF-16 transport patches; their complete patched source and original notices are included in `native/vendor`. Other dependency source files are unmodified.
6
6
 
7
- Cargo.lock SHA-256: `a7962957958e0640ea9e40f025e877864c03bd5934a1ca2e19df80a5481d72ff`.
7
+ Cargo.lock SHA-256: `db632d8fb3f5612f4e34f742fdde2b58d27cd17b7132583c28f183f00005ae19`.
8
8
 
9
9
  ## Source availability
10
10
 
@@ -24,8 +24,9 @@ use crate::id_hash::IdMap;
24
24
  use crate::NativeDocument;
25
25
 
26
26
  pub(crate) const STRIDE: usize = 15;
27
- /// Text longer than this stays out of snapshots: such nodes, mostly inline
28
- /// scripts and styles, are read individually if JavaScript asks for them.
27
+ /// Text or attribute values longer than this stay out of snapshots: such
28
+ /// nodes, mostly inline scripts, styles, SVG paths and embedded data, are read
29
+ /// individually if JavaScript asks for them.
29
30
  const LARGE_TEXT_BYTES: usize = 4096;
30
31
  const ABSENT: u32 = u32::MAX;
31
32
  const HAS_START_INDEX: u32 = 1;
@@ -297,8 +298,17 @@ impl Builder {
297
298
  None => {}
298
299
  }
299
300
  fields[8] = (self.attributes.len() / 2) as u32;
300
- fields[9] = node.attribs.len() as u32;
301
- for (name, value) in &node.attribs {
301
+ let has_large_attribute = node.attribs.values().any(|value| {
302
+ value
303
+ .as_str()
304
+ .is_some_and(|value| value.len() > LARGE_TEXT_BYTES)
305
+ });
306
+ if has_large_attribute {
307
+ flags |= OPAQUE;
308
+ } else {
309
+ fields[9] = node.attribs.len() as u32;
310
+ }
311
+ for (name, value) in node.attribs.iter().filter(|_| !has_large_attribute) {
302
312
  let Some(value) = value.as_str() else {
303
313
  flags |= OPAQUE;
304
314
  break;
@@ -454,12 +464,20 @@ impl Builder {
454
464
  _ => tag_type,
455
465
  };
456
466
  fields[6] = self.local_name(&element.name.local) + 1;
457
- for (attribute, value) in &element.attrs {
458
- let attribute = self.local_name(&attribute.local);
459
- let value = self.string(value);
460
- self.attributes.extend_from_slice(&[attribute, value]);
467
+ if element
468
+ .attrs
469
+ .iter()
470
+ .any(|(_, value)| value.len() > LARGE_TEXT_BYTES)
471
+ {
472
+ flags |= OPAQUE;
473
+ } else {
474
+ for (attribute, value) in &element.attrs {
475
+ let attribute = self.local_name(&attribute.local);
476
+ let value = self.string(value);
477
+ self.attributes.extend_from_slice(&[attribute, value]);
478
+ }
479
+ fields[9] = element.attrs.len() as u32;
461
480
  }
462
- fields[9] = element.attrs.len() as u32;
463
481
  fields[13] = self.namespace(&element.name.ns);
464
482
  flags |= HAS_NAMESPACE | EMPTY_ATTRIBUTE_MAPS;
465
483
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rusteerio",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Cheerio-compatible HTML processing with a Rust engine and parallel, non-blocking extraction",
5
5
  "license": "MIT",
6
6
  "repository": {
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file