[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-112743":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":14,"stars30d":14,"stars90d":12,"forks30d":12,"starsTrendScore":14,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":9,"pushedAt":28,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":12,"starSnapshotCount":12,"syncStatus":14,"lastSyncTime":32,"discoverSource":33},112743,"rusteerio","context-dot-dev\u002Frusteerio","context-dot-dev","Cheerio-compatible HTML\u002FXML processing powered by Rust, with configurable parallel extraction. Built by context.dev.",null,"TypeScript",53,0,51,2,41.2,"MIT License",false,"main",true,[21,22,23,24,25,26,27],"cheerio","html","nodejs","npm","rust","typescript","web-scraping","2026-11-18 15:24:40","2026-11-21 17:03:51","\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fcontext.dev\">\n    \u003Cpicture>\n      \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets\u002Fcontext-logo-white.svg\">\n      \u003Cimg src=\"assets\u002Fcontext-logo.svg\" alt=\"Context.dev\" width=\"240\">\n    \u003C\u002Fpicture>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Ch1 align=\"center\">rusteerio\u003C\u002Fh1>\n\n\u003Cp align=\"center\">Cheerio's API on a Rust engine, with parallel workers and zero npm dependencies.\u003C\u002Fp>\n\n**Heavily inspired by [Cheerio](https:\u002F\u002Fcheerio.js.org\u002F)** and its familiar,\nflexible HTML API. Built by the **[context.dev team](https:\u002F\u002Fcontext.dev)**.\n\n[![CI](https:\u002F\u002Fgithub.com\u002Fcontext-dot-dev\u002Frusteerio\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?branch=main)](https:\u002F\u002Fgithub.com\u002Fcontext-dot-dev\u002Frusteerio\u002Factions\u002Fworkflows\u002Fci.yml)\n[![Cheerio tests](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCheerio_tests-777_passing-brightgreen)](test\u002Fupstream\u002FREADME.md)\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Frusteerio)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Frusteerio)\n[![MIT license](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue)](LICENSE)\n[![Built by context.dev](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fbuilt_by-context.dev-202020)](https:\u002F\u002Fcontext.dev)\n[![Runtime dependencies](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fnpm_runtime_dependencies-0-brightgreen)](package.json)\n\nCheerio's interface, a Rust HTML\u002FXML engine, and configurable parallel workers.\nRusteerio keeps the DOM, parsing, selectors, mutations and serialization in a\nnative addon, with **zero npm runtime dependencies**. TypeScript supplies the\nAPI, stable node views, user callbacks and Node.js I\u002FO.\n\n## Why this exists\n\nCheerio makes server-side HTML processing approachable. We wanted to keep that\nexperience while making large scraping and extraction workloads faster and\ngiving applications a way to move CPU work off the JavaScript main thread.\n\nRusteerio combines a familiar synchronous API with additional async batch APIs.\nUse the synchronous API for ordinary document work, or set a worker limit when\nprocessing many documents. The implementation is independent of Cheerio's\nJavaScript engine; Cheerio is a development dependency used to check behavior.\n\n## Installation\n\nThe npm package name is **`rusteerio`**:\n\n```sh\nnpm install rusteerio\n```\n\nNode.js **20.19 or newer** is required. Release tarballs bundle native binaries\nfor macOS arm64\u002Fx64, Linux glibc and musl arm64\u002Fx64, and Windows arm64\u002Fx64. Supported\nplatforms need no Rust installation and no install script. For a source checkout,\nfollow [Development](#development).\n\nLinux GNU binaries require **glibc 2.28 or newer**. Musl binaries are tested on\n**Alpine 3.24**. Linux also needs `libgcc_s.so.1`; minimal Alpine images can\ninstall it with `apk add --no-cache libgcc`.\n\n## Familiar Cheerio API\n\n```ts\nimport * as rusteerio from 'rusteerio';\n\nconst $ = rusteerio.load('\u003Cul>\u003Cli class=\"fruit\">Apple\u003C\u002Fli>\u003C\u002Ful>');\n\n$('li').addClass('fresh').attr('data-id', '1');\nconsole.log($('.fruit').text()); \u002F\u002F Apple\nconsole.log($.html());\n```\n\nCommonJS works too:\n\n```js\nconst rusteerio = require('rusteerio');\nconst $ = rusteerio.load('\u003Ch1>Hello\u003C\u002Fh1>');\nconsole.log($('h1').text());\n```\n\nThe API includes selectors and traversal, DOM insertion and removal, cloning,\nattributes and properties, classes, styles, form values and serialization,\nHTML\u002FXML output, extraction, buffers, streams and URL loading. The\n`rusteerio\u002Fslim` and `rusteerio\u002Futils` entry points are included. TypeScript\ndeclarations are self-contained, with ESM and CommonJS support.\n\nXML parsing preserves case and supports CDATA:\n\n```ts\nconst $ = rusteerio.load('\u003CRoot>\u003CItem Id=\"1\"\u002F>\u003C\u002FRoot>', { xml: true });\nconsole.log($('Item').attr('Id')); \u002F\u002F 1\n```\n\n## Parallel extraction and worker limits\n\n```ts\nimport { configureWorkers, loadAsync, loadAll, extractAll, workerPoolInfo } from 'rusteerio';\n\n\u002F\u002F Set one process-wide CPU budget before starting asynchronous native work.\nconfigureWorkers({ threads: 4 });\n\nconst $ = await loadAsync(largeHtml);\nconst documents = await loadAll(htmlPages, { threads: 4 });\n\nconst rows = await extractAll(htmlPages, {\n  title: 'h1',\n  headings: ['h2'],\n  links: [{ selector: 'a', value: 'href' }],\n}, { threads: 4 });\n\nconsole.log(workerPoolInfo()); \u002F\u002F configured budget, active work and peak usage\n```\n\n| API | Result | Native work |\n| --- | --- | --- |\n| `loadAsync(content, options?, isDocument?)` | `Promise\u003CCheerioAPI>` | Parses off-thread |\n| `loadAll(strings, options?, isDocument?)` | `Promise\u003CCheerioAPI[]>` | Parses documents in parallel |\n| `extractAll(strings, map, options?)` | Extracted objects in input order | Parses and extracts in parallel |\n\n`configureWorkers({ threads: 4 })` (or `configureWorkers(4)`) caps active native\nCPU work across concurrent batches, single-document async parsing and streams.\nSet it before starting asynchronous native work. You can also set\n`RUSTEERIO_THREADS=4` before starting Node. The default is available CPUs, capped\nat 256. Configuration accepts integers from **1 to 256**; changing the budget\nafter work starts throws. Reapplying the same budget is allowed.\n\nThe per-batch `threads` option can lower a batch's parallelism within that shared\nbudget. Results preserve input order. `{ xml: true, threads: 4 }` works too.\n`workerPoolInfo()` reports `threads`, `activeBatches`, `activeWorkers` and\n`peakActiveWorkers`. The cap measures active CPU work; streams can have additional\nparked threads waiting for input or a JavaScript callback. Synchronous calls use\nidle workers of the same pool for large internal work, such as copying a large\nparse tree into the mutable tree on its first write or freeing a large tree, and\nnever wait for a busy worker. Before the pool exists, one background thread frees\nlarge trees, so collecting a large document does not stall JavaScript.\n\nSynchronous `load()`, queries, mutations and serialization **block the main\nthread** while they run. The async APIs move heavy native work onto workers;\ninput copying, result decoding and user callbacks still run on the JavaScript\nthread. Pure extraction maps, including nested maps, execute entirely in Rust\nbefore their results are decoded. Callback extraction yields between groups of\nelements, preserving closures and callback order. A single expensive callback\ncan still block the main thread.\n\n## Streams and parser extensions\n\n`stringStream()` incrementally parses strings in Rust. `decodeStream()` sniffs a\nbounded encoding prefix and decodes incoming byte chunks; `fromURL()` feeds the\nsame parser as the response arrives. Writable backpressure bounds queued input.\nHTTP loading supports redirects, abort signals, header\u002Fbody timeouts and response\nsize limits. A caller can supply an Undici-compatible dispatcher.\n\nCustom HTML5 `treeAdapter` methods participate in tree construction, and\n`onParseError` receives parser diagnostics. The HTML\u002FXML tokenizer's custom\n`Tokenizer` constructor and callbacks are supported as well. User code runs in\nJavaScript. Arbitrary custom tokenizers can refer to earlier source offsets, so\nthat path retains the source until completion. Source locations retain extra\nmetadata; avoid enabling them when you do not need it.\n\nDOM views expose writable Cheerio-compatible fields and stable identity. Parent\nnodes have an own `children` accessor for compatibility with `domhandler` helpers;\nother fields are accessors on the prototype. Read `node.attribs`, `node.children`\nand the other fields directly. Change the tree\nthrough the Cheerio API or by assigning node fields: writing an index or the\n`length` of a `children` array changes only that array. Removed branches stay\nusable while their selections or nodes are held, and a held node keeps its\ndocument alive; unreachable branches can be reclaimed and their Rust storage\nreused. The optional `dom`\nnamespace exports constructors such as `dom.Element`, `dom.Text` and\n`dom.Document`. Nodes imported from another DOM retain their original prototype.\nFresh Rust-backed nodes have Rusteerio's constructors: an `instanceof` check\nagainst an independently installed `domhandler.Element` requires importing those\nnodes or supplying a tree adapter that creates that class.\n\nEach document reports its approximate native size to V8, so the garbage\ncollector reclaims unreachable documents under native memory pressure. A\ndocument's Rust tree is freed when V8 collects the document, including during\na long synchronous loop: loading 60 documents of 36 MB each in one synchronous\nloop grows RSS by about 100 MB after the first 20, where earlier releases held\nevery tree until the loop ended.\n\n## Benchmarks\n\n### Compared with other Node.js HTML libraries\n\n[![Pages per second on 1 and 16 CPUs for rusteerio, cheerio, parse5 and jsdom.](bench\u002Flibraries\u002Foverview-v4.svg)](bench\u002Flibraries\u002FREADME.md)\n\nOnly parsers that build a WHATWG-compliant tree are compared. htmlparser2 and node-html-parser pass under 1% of the WPT parsing tests, so they are excluded.\n\nThe same extraction job ran over 3,000 Common Crawl pages (510 MB): load the page, then read the title, the meta description, every `a[href]`, the h1–h3 text and the image count. On one CPU, rusteerio was **4.5× faster than cheerio**, 1.6× faster than parse5 and 30× faster than jsdom. At 16 CPUs it used **the least working memory of the four** (1.7 GB vs 7.2 GB for cheerio). With `extractAll`, rusteerio stops scaling at about 8 CPUs because its main thread copies every page in and every result out, so at 16 CPUs parse5 was faster. Run as its synchronous API in a `worker_threads` pool, the same setup the other libraries use, rusteerio scaled 4.8× from 1 to 16 CPUs and reached **1,760 pages\u002Fs at 16 CPUs**: 1.1× faster than parse5 and 3.0× faster than cheerio, using 3.9 GB of working memory.\n\n| Library | Pages\u002Fs, 1 CPU | Pages\u002Fs, 16 CPUs | Working memory, 16 CPUs | WPT parsing tests | Feature probes | Packages |\n| --- | ---: | ---: | ---: | ---: | ---: | ---: |\n| **rusteerio** · extractAll | **415** | **1,390** | **1.7 GB** | **92.7%** | **20\u002F22** | **1** |\n| **rusteerio** · worker pool | **364** | **1,760** | **3.9 GB** | **92.7%** | **20\u002F22** | **1** |\n| cheerio · worker pool | 92 | 588 | 7.2 GB | 92.5% | 17\u002F22 | 23 |\n| jsdom · worker pool | 14 | 73 | 9.8 GB | 92.4% | 14\u002F22 | 36 |\n| parse5 · worker pool | 267 | 1,557 | 5.6 GB | 92.5% | 6\u002F22 | 2 |\n\n[![Throughput from 1 to 16 CPUs, log scale.](bench\u002Flibraries\u002Fscaling-v4.svg)](bench\u002Flibraries\u002FREADME.md#throughput-across-cpu-budgets)\n\n[![Working memory at 16 CPUs and memory per MB of parsed HTML.](bench\u002Flibraries\u002Fmemory-v4.svg)](bench\u002Flibraries\u002FREADME.md#memory)\n\n[![WHATWG tree-construction conformance and feature probes.](bench\u002Flibraries\u002Fcorrectness-v4.svg)](bench\u002Flibraries\u002FREADME.md#conformance-and-features)\n\nEach configuration ran on 3 separate boat.dev VMs with 16 vCPUs (AMD Ryzen 9 9950X) and 32 GB of RAM, using Node 24.18.1. Values are the median across the VMs. [Full tables, method, raw results and reproduction](bench\u002Flibraries\u002FREADME.md).\n\n### rusteerio vs Cheerio in detail\n\nThese measurements compare **Cheerio 1.2.0** against rusteerio on a Linux x64\n**VM with 8 vCPUs and 16 GB RAM** (AMD Ryzen 9 9950X host), running Node\n24.18.1. Every benchmark checks that both engines produce the same output.\n\n**Real pages.** 5,000 pages from a public Common Crawl archive each ran a\ntypical extraction job: load, title and metadata, headings, links, images with\ntheir link ancestry and depth, structured data, a paragraph filter, an element\ncount, removal of scripts and styles, body text and serialization. Outputs were\nidentical on all 5,000 pages, and times include loading.\n\n| Measure | Result |\n| --- | --- |\n| Total time | Cheerio 22.5 s, rusteerio 10.2 s: **2.22× faster** |\n| Pages where rusteerio was faster | **4,963 of 5,000**, and the other 37 when rerun |\n| Per-page speedup, 10th \u002F 50th \u002F 90th percentile | 1.26× \u002F 1.64× \u002F 2.20× |\n\nThe 37 pages that measured slower in the full pass (as low as 0.55×) all measured\n1.20× to 2.04× faster when rerun with 25 samples each on the same machine.\n\n**Single operations.** `bench\u002Foperations.mjs` times 25 operations on freshly\nloaded generated documents of 200 and 2,000 cards. Including each engine's load\ntime, rusteerio was faster for **50 of 50** HTML measurements in both runs\n(median 1.91–2.04×) and **48 of 50** XML measurements (median 1.95–2.05×). HTML\nloading alone was 1.77–2.12× faster and XML loading 1.96–2.70× faster.\n\n**Matched CPU budgets.** `bench\u002Ffair.mjs` gives both engines the same enforced\nCPU budget; batch comparisons give Cheerio a reused Node worker pool and include\neach engine's input and result conversion. Values are medians of nine samples.\nRusteerio was faster in **all 45 cases**. Representative results:\n\n| Workload | CPUs | Cheerio | rusteerio | rusteerio |\n| --- | ---: | ---: | ---: | --- |\n| Load\u002Fquery, 500 articles | 1 | 35.48 ms | 3.37 ms | 10.54× faster |\n| Load\u002Fquery, 5,000 articles | 1 | 151.35 ms | 36.64 ms | 4.13× faster |\n| HTML mutations, 5,000 articles | 1 | 250.75 ms | 67.27 ms | 3.73× faster |\n| XML load\u002Fquery, 5,000 articles | 1 | 74.23 ms | 16.97 ms | 4.37× faster |\n| Extract 16 documents × 5,000 articles | 1 | 3,058.97 ms | 473.02 ms | 6.47× faster |\n| Extract 16 documents × 5,000 articles | 8 | 788.30 ms | 130.88 ms | 6.02× faster |\n| Nested callback extraction, 8 × 500 articles | 8 | 55.11 ms | 33.78 ms | 1.63× faster |\n| Cold extraction, 16 × 20 articles | 8 | 21.64 ms | 9.88 ms | 2.19× faster |\n| 8 concurrent batches × 8 × 300 articles | 8 | 113.00 ms | 25.55 ms | 4.42× faster |\n| HTML stream, 50,000 elements | 1 | 1,259.20 ms | 353.46 ms | 3.56× faster |\n| XML stream, 50,000 elements | 8 | 126.08 ms | 69.93 ms | 1.80× faster |\n| Append\u002Fupdate\u002Fremove, 4,000 cycles | 1 | 733.50 ms | 443.06 ms | 1.66× faster |\n\nCold measurements include engine import, pool initialization and the first\nbatch.\n\n**Where Cheerio can be faster.** Rusteerio builds node objects lazily from the\nnative tree, and an element's `attribs` is a `Proxy` so that assigning or\ndeleting a key changes the document, as it does in Cheerio. Code that visits\nevery node and enumerates every element's attributes (`Object.keys(node.attribs)`)\npays for creating those objects and for V8's slower key enumeration on proxies.\nIncluding load, that walk measured 0.54–0.72× in XML, where Cheerio's\nhtmlparser2 parser leaves less load time to win back, and faster than Cheerio in\nHTML. Walking the same nodes without enumerating attributes is faster in both.\n\n**Memory.** A batch extracting 16 documents of 5,000 articles with eight CPUs\nended at 620 MB RSS for rusteerio and 2,449 MB for Cheerio's worker pool, the\nHTML stream of 50,000 elements at 364 MB versus 666 MB, and the large XML\nload\u002Fquery at 140 MB versus 149 MB. The XML stream ended slightly higher, at\n229 MB versus 222 MB, and the append\u002Fupdate\u002Fremove workload about even (93 MB\nversus 91 MB). Linux builds use mimalloc, which keeps freed pages briefly for\nreuse; after a parse that builds at least 100,000 nodes, the parsing thread\nreturns them to the system. RSS includes initialization and resident input, and\nsampled peaks do not establish a universal memory bound.\n\nThese results describe this VM and revision; hardware, runtime and input shape\naffect them. See [the results](bench\u002Fresults\u002F2026-10-14\u002F) and\n[the methodology and reproduction steps](bench\u002FREADME.md).\n\n## Compatibility and tests\n\nThe compatibility target is **Cheerio 1.2.0**. All **777 upstream tests across all\n14 files** run against rusteerio, including parser and utility tests. Assertions\nand fixtures are unchanged; implementation imports are redirected. An integrity\ncheck verifies the complete inventory and source checksums before each run.\n\nThe additional **501 runtime and release checks** cover custom parser hooks,\nstreaming encodings and HTTP, detached-node retention and reuse, cross-document\nmoves, memory release, extraction callbacks, shared CPU limits and Cheerio's\nselection order. **57 Rust tests**, strict TypeScript consumer checks, and clean\nnpm tarball installation checks run as well. CI builds and tests all eight\nnative targets\nand checks Node 20.19, 22 and 24. GNU binaries are built and run on glibc 2.28;\nrelease checks inspect their actual ELF version requirements.\n\nSee [the upstream test suite](test\u002Fupstream\u002FREADME.md) and [the latest validation\nrecord](bench\u002Fresults\u002Ffair\u002Fvalidation.json). Compatibility tests establish\ncoverage for that version; they do not establish behavior for every possible\ninput or private extension.\n\n## Development\n\nUse Node.js 20.19+ and stable Rust:\n\n```sh\ngit clone https:\u002F\u002Fgithub.com\u002Fcontext-dot-dev\u002Frusteerio.git\ncd rusteerio\nnpm ci\nnpm run build\nnpm test\nnpm run test:upstream\nnpm run check\nnpm run test:types\nnpm run test:package\ncargo test\ncargo fmt --all -- --check\ncargo clippy --all-targets -- -D warnings\n```\n\nThe Rust engine uses html5ever and scraper for HTML5 parsing and fast queries,\nalongside its mutable arena, HTML\u002FXML tokenizer and selector implementation.\nRust dependencies are compiled into the addon and pinned in `Cargo.lock`.\nDevelopment dependencies supply build tools and compatibility oracles; package\nconsumers install no additional npm packages.\n\nContributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for local\nchecks and test conventions, and [RELEASING.md](RELEASING.md) for the npm release\nprocess.\n\n## Credits and license\n\nCreated by the **[context.dev team](https:\u002F\u002Fcontext.dev)**, with thanks to\n[Cheerio and its contributors](https:\u002F\u002Fgithub.com\u002Fcheeriojs\u002Fcheerio) for the API\nand upstream test suite that inspired this project.\n\nRusteerio's original code is **[MIT licensed](LICENSE)**. Vendored Cheerio tests\nretain their [upstream MIT license](test\u002Fupstream\u002FLICENSE). Native dependencies\nretain their own terms, collected in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).\n","rusteerio 是一个基于 Rust 实现的 HTML\u002FXML 解析与操作库，提供与 Cheerio 完全兼容的 TypeScript API。其核心功能包括同步 DOM 操作（选择器、属性修改、文本提取、序列化等）及可配置的并行文档处理能力，所有解析与计算逻辑均在零 npm 运行时依赖的原生模块中执行。技术特点涵盖 Rust 驱动的高性能解析引擎、Node.js 20.19+ 原生二进制分发、无构建依赖的开箱即用设计，以及同步\u002F异步双模式 API。适用于大规模网页抓取、服务端 HTML 渲染、批量内容提取等对 CPU 效率和并发吞吐有要求的 Node.js 后端场景。","2026-11-24 04:43:59","CREATED_QUERY"]