Skip to content

v1.0.0-rc.11

Compare
Choose a tag to compare
@fb55 fb55 released this 20 May 15:27
· 1094 commits to main since this release

cheerio@1.0.0-rc.11 is hopefully the last RC before the 1.0.0 release of Cheerio. There are two APIs that will be added for the next major release: An exract method (#2523) and NodeJS specific loader methods (#2051). These are still in flux and I'd appreciate feedback on the proposals.

A big thank you to everyone that contributed to this release! This includes code contributors, as well as the amazing financial support on GitHub Sponsors!

Under the hood, a lot of work for this release went into updating parse5, cheerio's default HTML parser. Have a look at parse5's release notes to see what has changed there.

Breaking

  • Cheerio is now a dual CommonJS and ESM module. That means that deep imports will now fail in newer versions of Node. #2508
  • script and style contents are added again in .text() #2509
    • To keep the old behavior, switch .text() to .prop('innerText')
  • The TypeScript types inherited from upstream dependencies have changed. #2503
    • Node types are now using tagged unions, which will make consumption a bit easier.

Features

  • Relevant options are now forwarded to cheerio-select #2511
  • For the .prop() method:
    • Add textContent and innerText props #2214
    • Users can now specify a baseURI option, which will lead to href and src props to be resolved as URLs. #2510
  • Added a slim export, which will always use htmlparser2 #1960

Fixes

  • Have text turn passed values to strings #2047
  • Include undefined in the return type of get by @glen-84 in #2392
  • Recognise comments as HTML #2504
  • Add missing undefined return value #2505
  • Export missing static methods #2506
  • Have style parsing add malformed fields to previous field #2521

Refactor

  • Use domutils module directly #1928
  • Hand-roll isHTML #1935
  • Move initialization logic to load #1951
  • Only return elements in closest #2057
  • Remove unnecessary code, be more explicit #2279
  • Use stricter TS, ESLint configs #2507
  • Update exported values #2512

Development Experience

Docs

New Contributors

Full Changelog: v1.0.0-rc.10...v1.0.0-rc.11