Cheerio 1.0 is here! 🎉
Announcement Blog Post
Breaking Changes
-
The minimum NodeJS version is now 18.17 or higher #3959
-
Import paths were simplified. For example, use
cheerio/slim
instead of
cheerio/lib/slim
. #3970 -
The deprecated default Cheerio instance and static methods were removed. #3974
Before, it was possible to write code like this:
import cheerio, { html } from 'cheerio'; html(cheerio('<test></test>')); // ~ '<test></test>' -- NO LONGER WORKS
Make sure to always load documents first:
import * as cheerio from 'cheerio'; cheerio.load('<test></test>').html();
-
Node types previously re-exported by Cheerio must now be imported directly
from (domhandler
)(https://github.com/fb55/domhandler). #3969 -
htmlparser2 options now reside exclusively under the
xml
key (#2916):const $ = cheerio.load('<html>', { xml: { withStartIndices: true, }, });
New Features
- Add functions to load buffers, streams & URLs in NodeJS by @fb55 in #2857
- Add extract method by @fb55 in #2750
Fixes
- Allow imports of
cheerio/utils
by @blixt in #2601 - Allow empty string in
data
, and simplify by @fb55 in #2818 - Make
closest
be able to start from text nodes by @Qualtagh in #2811 - Fix potential github action smells by @ceddy4395 in #3826
Other
- Cheerio has a new website, featuring updated API docs and guides! #2950
Full Changelog: v1.0.0-rc.12...v1.0.0