Skip to content

Commit

Permalink
fix: use namespace imports for cheerio to be compatible with v1 (#2641)
Browse files Browse the repository at this point in the history
We keep the last RC pinned in the dependencies for now, but is just a
forward upgrade which is compatible with both versions.
  • Loading branch information
B4nan authored Aug 28, 2024
1 parent 9c21e35 commit f48296f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/utils/src/internals/cheerio.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Dictionary } from '@crawlee/types';
import type { load, CheerioAPI } from 'cheerio';
import cheerio from 'cheerio';
import * as cheerio from 'cheerio';

import { tryAbsoluteURL } from './extract-urls';

Expand Down Expand Up @@ -32,7 +32,7 @@ const BLOCK_TAGS_REGEX =
* with the `decodeEntities` option set to `true`. For example:
*
* ```javascript
* import cheerio from 'cheerio';
* import * as cheerio from 'cheerio';
* const html = '<html><body>Some text</body></html>';
* const text = htmlToText(cheerio.load(html, { decodeEntities: true }));
* ```
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/internals/social.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cheerio from 'cheerio';
import * as cheerio from 'cheerio';

import { htmlToText } from './cheerio';

Expand Down
2 changes: 1 addition & 1 deletion test/utils/cheerio.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CheerioRoot } from '@crawlee/utils';
import { htmlToText } from '@crawlee/utils';
import cheerio from 'cheerio';
import * as cheerio from 'cheerio';

import * as htmlToTextData from '../shared/data/html_to_text_test_data';

Expand Down

0 comments on commit f48296f

Please sign in to comment.