Skip to content

Commit 08dfa94

Browse files
authored
Merge pull request #445 from easyops-cn/steve/fix-cheerio
fix: update cheerio to 1.0.0
2 parents 4517bde + c04468a commit 08dfa94

File tree

10 files changed

+110
-10
lines changed

10 files changed

+110
-10
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"overrides": [
2626
{
27-
"files": ["*.config.js", "__jest__/**/*.js"],
27+
"files": ["jestSetup.js", "*.config.js", "__jest__/**/*.js"],
2828
"env": {
2929
"node": true,
3030
"browser": false

docusaurus-search-local/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@docusaurus/utils-validation": "^2 || ^3",
3838
"@easyops-cn/autocomplete.js": "^0.38.1",
3939
"@node-rs/jieba": "^1.6.0",
40-
"cheerio": "^1.0.0-rc.3",
40+
"cheerio": "^1.0.0",
4141
"clsx": "^1.1.1",
4242
"debug": "^4.2.0",
4343
"fs-extra": "^10.0.0",

docusaurus-search-local/src/server/utils/getCondensedText.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cheerio from "cheerio";
1+
import * as cheerio from "cheerio";
22
import { getCondensedText } from "./getCondensedText";
33

44
describe("getCondensedText", () => {

docusaurus-search-local/src/server/utils/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cheerio from "cheerio";
1+
import * as cheerio from "cheerio";
22
import {
33
ParsedDocument,
44
ProcessedPluginOptions,

docusaurus-search-local/src/server/utils/parseDocument.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cheerio from "cheerio";
1+
import * as cheerio from "cheerio";
22
import { ParsedDocument } from "../../shared/interfaces";
33
import { parseDocument } from "./parseDocument";
44

docusaurus-search-local/src/server/utils/parsePage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cheerio from "cheerio";
1+
import * as cheerio from "cheerio";
22
import { ParsedDocument } from "../../shared/interfaces";
33
import { parsePage } from "./parsePage";
44

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
moduleNameMapper: {
1313
"\\.module\\.css$": require.resolve("identity-obj-proxy"),
1414
"@docusaurus/Translate": "<rootDir>/__mocks__/Translate.js",
15+
"^cheerio$": require.resolve("cheerio"),
1516
},
1617
// Ref https://github.com/facebook/jest/issues/2070#issuecomment-431706685
1718
// Todo(steve): remove next line when issue fixed.

jestSetup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import { matcherHint, printExpected, printReceived } from "jest-matcher-utils";
2+
import { TextEncoder, TextDecoder } from "node:util";
3+
import { ReadableStream } from "node:stream/web";
4+
5+
Object.assign(global, { TextDecoder, TextEncoder, ReadableStream });
26

37
const passMessage = (actual, expected) => () =>
48
`${matcherHint(".not.toMatchPath")}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@typescript-eslint/eslint-plugin": "^6.10.0",
2626
"@typescript-eslint/parser": "^6.10.0",
2727
"babel-jest": "^28.1.0",
28+
"cheerio": "^1.0.0",
2829
"cross-env": "^7.0.3",
2930
"eslint": "^8.15.0",
3031
"eslint-config-prettier": "^8.5.0",

yarn.lock

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3478,7 +3478,7 @@ __metadata:
34783478
"@types/react": "npm:^18.2.37"
34793479
"@types/react-helmet": "npm:^6.1.0"
34803480
"@types/react-router-dom": "npm:^5.1.6"
3481-
cheerio: "npm:^1.0.0-rc.3"
3481+
cheerio: "npm:^1.0.0"
34823482
clsx: "npm:^1.1.1"
34833483
concurrently: "npm:^7.0.0"
34843484
copyfiles: "npm:^2.4.0"
@@ -6436,7 +6436,26 @@ __metadata:
64366436
languageName: node
64376437
linkType: hard
64386438

6439-
"cheerio@npm:^1.0.0-rc.12, cheerio@npm:^1.0.0-rc.3":
6439+
"cheerio@npm:^1.0.0":
6440+
version: 1.0.0
6441+
resolution: "cheerio@npm:1.0.0"
6442+
dependencies:
6443+
cheerio-select: "npm:^2.1.0"
6444+
dom-serializer: "npm:^2.0.0"
6445+
domhandler: "npm:^5.0.3"
6446+
domutils: "npm:^3.1.0"
6447+
encoding-sniffer: "npm:^0.2.0"
6448+
htmlparser2: "npm:^9.1.0"
6449+
parse5: "npm:^7.1.2"
6450+
parse5-htmlparser2-tree-adapter: "npm:^7.0.0"
6451+
parse5-parser-stream: "npm:^7.1.2"
6452+
undici: "npm:^6.19.5"
6453+
whatwg-mimetype: "npm:^4.0.0"
6454+
checksum: b535070add0f86b0a1f234274ad3ffb2c1c375c05b322d8057e89c3c797b3b4d2f05826c34a04df218bec9abf21b9f0d0bd71974a8dfe28b943fb87ab0170c38
6455+
languageName: node
6456+
linkType: hard
6457+
6458+
"cheerio@npm:^1.0.0-rc.12":
64406459
version: 1.0.0-rc.12
64416460
resolution: "cheerio@npm:1.0.0-rc.12"
64426461
dependencies:
@@ -7740,6 +7759,17 @@ __metadata:
77407759
languageName: node
77417760
linkType: hard
77427761

7762+
"domutils@npm:^3.1.0":
7763+
version: 3.1.0
7764+
resolution: "domutils@npm:3.1.0"
7765+
dependencies:
7766+
dom-serializer: "npm:^2.0.0"
7767+
domelementtype: "npm:^2.3.0"
7768+
domhandler: "npm:^5.0.3"
7769+
checksum: 9a169a6e57ac4c738269a73ab4caf785114ed70e46254139c1bbc8144ac3102aacb28a6149508395ae34aa5d6a40081f4fa5313855dc8319c6d8359866b6dfea
7770+
languageName: node
7771+
linkType: hard
7772+
77437773
"dot-case@npm:^3.0.4":
77447774
version: 3.0.4
77457775
resolution: "dot-case@npm:3.0.4"
@@ -7843,6 +7873,16 @@ __metadata:
78437873
languageName: node
78447874
linkType: hard
78457875

7876+
"encoding-sniffer@npm:^0.2.0":
7877+
version: 0.2.0
7878+
resolution: "encoding-sniffer@npm:0.2.0"
7879+
dependencies:
7880+
iconv-lite: "npm:^0.6.3"
7881+
whatwg-encoding: "npm:^3.1.1"
7882+
checksum: fe61a759dbef4d94ddc6f4fa645459897f4275eba04f0135d0459099b5f62fbba8a7ae57d23c9ec9b118c4c39ce056b51f1b8e62ad73a8ab365699448d655f4c
7883+
languageName: node
7884+
linkType: hard
7885+
78467886
"encoding@npm:^0.1.13":
78477887
version: 0.1.13
78487888
resolution: "encoding@npm:0.1.13"
@@ -7876,7 +7916,7 @@ __metadata:
78767916
languageName: node
78777917
linkType: hard
78787918

7879-
"entities@npm:^4.4.0":
7919+
"entities@npm:^4.4.0, entities@npm:^4.5.0":
78807920
version: 4.5.0
78817921
resolution: "entities@npm:4.5.0"
78827922
checksum: ede2a35c9bce1aeccd055a1b445d41c75a14a2bb1cd22e242f20cf04d236cdcd7f9c859eb83f76885327bfae0c25bf03303665ee1ce3d47c5927b98b0e3e3d48
@@ -9530,6 +9570,18 @@ __metadata:
95309570
languageName: node
95319571
linkType: hard
95329572

9573+
"htmlparser2@npm:^9.1.0":
9574+
version: 9.1.0
9575+
resolution: "htmlparser2@npm:9.1.0"
9576+
dependencies:
9577+
domelementtype: "npm:^2.3.0"
9578+
domhandler: "npm:^5.0.3"
9579+
domutils: "npm:^3.1.0"
9580+
entities: "npm:^4.5.0"
9581+
checksum: 6352fa2a5495781fa9a02c9049908334cd068ff36d753870d30cd13b841e99c19646717567a2f9e9c44075bbe43d364e102f9d013a731ce962226d63746b794f
9582+
languageName: node
9583+
linkType: hard
9584+
95339585
"http-cache-semantics@npm:^4.1.0":
95349586
version: 4.1.0
95359587
resolution: "http-cache-semantics@npm:4.1.0"
@@ -9684,7 +9736,7 @@ __metadata:
96849736
languageName: node
96859737
linkType: hard
96869738

9687-
"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2":
9739+
"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2, iconv-lite@npm:^0.6.3":
96889740
version: 0.6.3
96899741
resolution: "iconv-lite@npm:0.6.3"
96909742
dependencies:
@@ -13114,6 +13166,15 @@ __metadata:
1311413166
languageName: node
1311513167
linkType: hard
1311613168

13169+
"parse5-parser-stream@npm:^7.1.2":
13170+
version: 7.1.2
13171+
resolution: "parse5-parser-stream@npm:7.1.2"
13172+
dependencies:
13173+
parse5: "npm:^7.0.0"
13174+
checksum: 75b232d460bce6bd0e35012750a78ef034f40ccf550b7c6cec3122395af6b4553202ad3663ad468cf537ead5a2e13b6727670395fd0ff548faccad1dc2dc93cf
13175+
languageName: node
13176+
linkType: hard
13177+
1311713178
"parse5@npm:6.0.1":
1311813179
version: 6.0.1
1311913180
resolution: "parse5@npm:6.0.1"
@@ -13130,6 +13191,15 @@ __metadata:
1313013191
languageName: node
1313113192
linkType: hard
1313213193

13194+
"parse5@npm:^7.1.2":
13195+
version: 7.1.2
13196+
resolution: "parse5@npm:7.1.2"
13197+
dependencies:
13198+
entities: "npm:^4.4.0"
13199+
checksum: 3c86806bb0fb1e9a999ff3a4c883b1ca243d99f45a619a0898dbf021a95a0189ed955c31b07fe49d342b54e814f33f2c9d7489198e8630dacd5477d413ec5782
13200+
languageName: node
13201+
linkType: hard
13202+
1313313203
"parseurl@npm:~1.3.2, parseurl@npm:~1.3.3":
1313413204
version: 1.3.3
1313513205
resolution: "parseurl@npm:1.3.3"
@@ -14839,6 +14909,7 @@ __metadata:
1483914909
"@typescript-eslint/eslint-plugin": "npm:^6.10.0"
1484014910
"@typescript-eslint/parser": "npm:^6.10.0"
1484114911
babel-jest: "npm:^28.1.0"
14912+
cheerio: "npm:^1.0.0"
1484214913
cross-env: "npm:^7.0.3"
1484314914
eslint: "npm:^8.15.0"
1484414915
eslint-config-prettier: "npm:^8.5.0"
@@ -16243,6 +16314,13 @@ __metadata:
1624316314
languageName: node
1624416315
linkType: hard
1624516316

16317+
"undici@npm:^6.19.5":
16318+
version: 6.19.7
16319+
resolution: "undici@npm:6.19.7"
16320+
checksum: 77fb8b0377388f6dba8244b015841318d621031211b4f3c2273d809304b77ec44adeba4b89dfd6708bdc044190e18f068e5b231882ef15d057d4624e46f544e3
16321+
languageName: node
16322+
linkType: hard
16323+
1624616324
"unicode-canonical-property-names-ecmascript@npm:^2.0.0":
1624716325
version: 2.0.0
1624816326
resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0"
@@ -16938,13 +17016,29 @@ __metadata:
1693817016
languageName: node
1693917017
linkType: hard
1694017018

17019+
"whatwg-encoding@npm:^3.1.1":
17020+
version: 3.1.1
17021+
resolution: "whatwg-encoding@npm:3.1.1"
17022+
dependencies:
17023+
iconv-lite: "npm:0.6.3"
17024+
checksum: bbef815eb67f91487c7f2ef96329743f5fd8357d7d62b1119237d25d41c7e452dff8197235b2d3c031365a17f61d3bb73ca49d0ed1582475aa4a670815e79534
17025+
languageName: node
17026+
linkType: hard
17027+
1694117028
"whatwg-mimetype@npm:^3.0.0":
1694217029
version: 3.0.0
1694317030
resolution: "whatwg-mimetype@npm:3.0.0"
1694417031
checksum: 96f9f628c663c2ae05412c185ca81b3df54bcb921ab52fe9ebc0081c1720f25d770665401eb2338ab7f48c71568133845638e18a81ed52ab5d4dcef7d22b40ef
1694517032
languageName: node
1694617033
linkType: hard
1694717034

17035+
"whatwg-mimetype@npm:^4.0.0":
17036+
version: 4.0.0
17037+
resolution: "whatwg-mimetype@npm:4.0.0"
17038+
checksum: 894a618e2d90bf444b6f309f3ceb6e58cf21b2beaa00c8b333696958c4076f0c7b30b9d33413c9ffff7c5832a0a0c8569e5bb347ef44beded72aeefd0acd62e8
17039+
languageName: node
17040+
linkType: hard
17041+
1694817042
"whatwg-url@npm:^10.0.0":
1694917043
version: 10.0.0
1695017044
resolution: "whatwg-url@npm:10.0.0"

0 commit comments

Comments
 (0)