v1.0.0-rc.11
[email protected]
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
andstyle
contents are added again in.text()
#2509- To keep the old behavior, switch
.text()
to.prop('innerText')
- To keep the old behavior, switch
- 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- Custom pseudo classes can now be specified using the
pseudos
option.
- Custom pseudo classes can now be specified using the
- For the
.prop()
method: - 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 ofget
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
- Migrate husky to v6 by @DavideViolante in #1934
- Update CI by @XhmikosR in #2149
- Set permissions for GitHub actions by @neilnaveen in #2453
Docs
- Update README "is not a web browser" section by @mxschmitt in #2127
New Contributors
- @DavideViolante made their first contribution in #1934
- @mxschmitt made their first contribution in #2127
- @glen-84 made their first contribution in #2392
- @neilnaveen made their first contribution in #2453
Full Changelog: v1.0.0-rc.10...v1.0.0-rc.11