Skip to content

Commit

Permalink
Merge pull request #445 from easyops-cn/steve/fix-cheerio
Browse files Browse the repository at this point in the history
fix: update cheerio to 1.0.0
  • Loading branch information
weareoutman authored Aug 12, 2024
2 parents 4517bde + c04468a commit 08dfa94
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"overrides": [
{
"files": ["*.config.js", "__jest__/**/*.js"],
"files": ["jestSetup.js", "*.config.js", "__jest__/**/*.js"],
"env": {
"node": true,
"browser": false
Expand Down
2 changes: 1 addition & 1 deletion docusaurus-search-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@docusaurus/utils-validation": "^2 || ^3",
"@easyops-cn/autocomplete.js": "^0.38.1",
"@node-rs/jieba": "^1.6.0",
"cheerio": "^1.0.0-rc.3",
"cheerio": "^1.0.0",
"clsx": "^1.1.1",
"debug": "^4.2.0",
"fs-extra": "^10.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cheerio from "cheerio";
import * as cheerio from "cheerio";
import { getCondensedText } from "./getCondensedText";

describe("getCondensedText", () => {
Expand Down
2 changes: 1 addition & 1 deletion docusaurus-search-local/src/server/utils/parse.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 {
ParsedDocument,
ProcessedPluginOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cheerio from "cheerio";
import * as cheerio from "cheerio";
import { ParsedDocument } from "../../shared/interfaces";
import { parseDocument } from "./parseDocument";

Expand Down
2 changes: 1 addition & 1 deletion docusaurus-search-local/src/server/utils/parsePage.spec.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 { ParsedDocument } from "../../shared/interfaces";
import { parsePage } from "./parsePage";

Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
moduleNameMapper: {
"\\.module\\.css$": require.resolve("identity-obj-proxy"),
"@docusaurus/Translate": "<rootDir>/__mocks__/Translate.js",
"^cheerio$": require.resolve("cheerio"),
},
// Ref https://github.com/facebook/jest/issues/2070#issuecomment-431706685
// Todo(steve): remove next line when issue fixed.
Expand Down
4 changes: 4 additions & 0 deletions jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { matcherHint, printExpected, printReceived } from "jest-matcher-utils";
import { TextEncoder, TextDecoder } from "node:util";
import { ReadableStream } from "node:stream/web";

Object.assign(global, { TextDecoder, TextEncoder, ReadableStream });

const passMessage = (actual, expected) => () =>
`${matcherHint(".not.toMatchPath")}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"babel-jest": "^28.1.0",
"cheerio": "^1.0.0",
"cross-env": "^7.0.3",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
102 changes: 98 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3478,7 +3478,7 @@ __metadata:
"@types/react": "npm:^18.2.37"
"@types/react-helmet": "npm:^6.1.0"
"@types/react-router-dom": "npm:^5.1.6"
cheerio: "npm:^1.0.0-rc.3"
cheerio: "npm:^1.0.0"
clsx: "npm:^1.1.1"
concurrently: "npm:^7.0.0"
copyfiles: "npm:^2.4.0"
Expand Down Expand Up @@ -6436,7 +6436,26 @@ __metadata:
languageName: node
linkType: hard

"cheerio@npm:^1.0.0-rc.12, cheerio@npm:^1.0.0-rc.3":
"cheerio@npm:^1.0.0":
version: 1.0.0
resolution: "cheerio@npm:1.0.0"
dependencies:
cheerio-select: "npm:^2.1.0"
dom-serializer: "npm:^2.0.0"
domhandler: "npm:^5.0.3"
domutils: "npm:^3.1.0"
encoding-sniffer: "npm:^0.2.0"
htmlparser2: "npm:^9.1.0"
parse5: "npm:^7.1.2"
parse5-htmlparser2-tree-adapter: "npm:^7.0.0"
parse5-parser-stream: "npm:^7.1.2"
undici: "npm:^6.19.5"
whatwg-mimetype: "npm:^4.0.0"
checksum: b535070add0f86b0a1f234274ad3ffb2c1c375c05b322d8057e89c3c797b3b4d2f05826c34a04df218bec9abf21b9f0d0bd71974a8dfe28b943fb87ab0170c38
languageName: node
linkType: hard

"cheerio@npm:^1.0.0-rc.12":
version: 1.0.0-rc.12
resolution: "cheerio@npm:1.0.0-rc.12"
dependencies:
Expand Down Expand Up @@ -7740,6 +7759,17 @@ __metadata:
languageName: node
linkType: hard

"domutils@npm:^3.1.0":
version: 3.1.0
resolution: "domutils@npm:3.1.0"
dependencies:
dom-serializer: "npm:^2.0.0"
domelementtype: "npm:^2.3.0"
domhandler: "npm:^5.0.3"
checksum: 9a169a6e57ac4c738269a73ab4caf785114ed70e46254139c1bbc8144ac3102aacb28a6149508395ae34aa5d6a40081f4fa5313855dc8319c6d8359866b6dfea
languageName: node
linkType: hard

"dot-case@npm:^3.0.4":
version: 3.0.4
resolution: "dot-case@npm:3.0.4"
Expand Down Expand Up @@ -7843,6 +7873,16 @@ __metadata:
languageName: node
linkType: hard

"encoding-sniffer@npm:^0.2.0":
version: 0.2.0
resolution: "encoding-sniffer@npm:0.2.0"
dependencies:
iconv-lite: "npm:^0.6.3"
whatwg-encoding: "npm:^3.1.1"
checksum: fe61a759dbef4d94ddc6f4fa645459897f4275eba04f0135d0459099b5f62fbba8a7ae57d23c9ec9b118c4c39ce056b51f1b8e62ad73a8ab365699448d655f4c
languageName: node
linkType: hard

"encoding@npm:^0.1.13":
version: 0.1.13
resolution: "encoding@npm:0.1.13"
Expand Down Expand Up @@ -7876,7 +7916,7 @@ __metadata:
languageName: node
linkType: hard

"entities@npm:^4.4.0":
"entities@npm:^4.4.0, entities@npm:^4.5.0":
version: 4.5.0
resolution: "entities@npm:4.5.0"
checksum: ede2a35c9bce1aeccd055a1b445d41c75a14a2bb1cd22e242f20cf04d236cdcd7f9c859eb83f76885327bfae0c25bf03303665ee1ce3d47c5927b98b0e3e3d48
Expand Down Expand Up @@ -9530,6 +9570,18 @@ __metadata:
languageName: node
linkType: hard

"htmlparser2@npm:^9.1.0":
version: 9.1.0
resolution: "htmlparser2@npm:9.1.0"
dependencies:
domelementtype: "npm:^2.3.0"
domhandler: "npm:^5.0.3"
domutils: "npm:^3.1.0"
entities: "npm:^4.5.0"
checksum: 6352fa2a5495781fa9a02c9049908334cd068ff36d753870d30cd13b841e99c19646717567a2f9e9c44075bbe43d364e102f9d013a731ce962226d63746b794f
languageName: node
linkType: hard

"http-cache-semantics@npm:^4.1.0":
version: 4.1.0
resolution: "http-cache-semantics@npm:4.1.0"
Expand Down Expand Up @@ -9684,7 +9736,7 @@ __metadata:
languageName: node
linkType: hard

"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2":
"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2, iconv-lite@npm:^0.6.3":
version: 0.6.3
resolution: "iconv-lite@npm:0.6.3"
dependencies:
Expand Down Expand Up @@ -13114,6 +13166,15 @@ __metadata:
languageName: node
linkType: hard

"parse5-parser-stream@npm:^7.1.2":
version: 7.1.2
resolution: "parse5-parser-stream@npm:7.1.2"
dependencies:
parse5: "npm:^7.0.0"
checksum: 75b232d460bce6bd0e35012750a78ef034f40ccf550b7c6cec3122395af6b4553202ad3663ad468cf537ead5a2e13b6727670395fd0ff548faccad1dc2dc93cf
languageName: node
linkType: hard

"parse5@npm:6.0.1":
version: 6.0.1
resolution: "parse5@npm:6.0.1"
Expand All @@ -13130,6 +13191,15 @@ __metadata:
languageName: node
linkType: hard

"parse5@npm:^7.1.2":
version: 7.1.2
resolution: "parse5@npm:7.1.2"
dependencies:
entities: "npm:^4.4.0"
checksum: 3c86806bb0fb1e9a999ff3a4c883b1ca243d99f45a619a0898dbf021a95a0189ed955c31b07fe49d342b54e814f33f2c9d7489198e8630dacd5477d413ec5782
languageName: node
linkType: hard

"parseurl@npm:~1.3.2, parseurl@npm:~1.3.3":
version: 1.3.3
resolution: "parseurl@npm:1.3.3"
Expand Down Expand Up @@ -14839,6 +14909,7 @@ __metadata:
"@typescript-eslint/eslint-plugin": "npm:^6.10.0"
"@typescript-eslint/parser": "npm:^6.10.0"
babel-jest: "npm:^28.1.0"
cheerio: "npm:^1.0.0"
cross-env: "npm:^7.0.3"
eslint: "npm:^8.15.0"
eslint-config-prettier: "npm:^8.5.0"
Expand Down Expand Up @@ -16243,6 +16314,13 @@ __metadata:
languageName: node
linkType: hard

"undici@npm:^6.19.5":
version: 6.19.7
resolution: "undici@npm:6.19.7"
checksum: 77fb8b0377388f6dba8244b015841318d621031211b4f3c2273d809304b77ec44adeba4b89dfd6708bdc044190e18f068e5b231882ef15d057d4624e46f544e3
languageName: node
linkType: hard

"unicode-canonical-property-names-ecmascript@npm:^2.0.0":
version: 2.0.0
resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0"
Expand Down Expand Up @@ -16938,13 +17016,29 @@ __metadata:
languageName: node
linkType: hard

"whatwg-encoding@npm:^3.1.1":
version: 3.1.1
resolution: "whatwg-encoding@npm:3.1.1"
dependencies:
iconv-lite: "npm:0.6.3"
checksum: bbef815eb67f91487c7f2ef96329743f5fd8357d7d62b1119237d25d41c7e452dff8197235b2d3c031365a17f61d3bb73ca49d0ed1582475aa4a670815e79534
languageName: node
linkType: hard

"whatwg-mimetype@npm:^3.0.0":
version: 3.0.0
resolution: "whatwg-mimetype@npm:3.0.0"
checksum: 96f9f628c663c2ae05412c185ca81b3df54bcb921ab52fe9ebc0081c1720f25d770665401eb2338ab7f48c71568133845638e18a81ed52ab5d4dcef7d22b40ef
languageName: node
linkType: hard

"whatwg-mimetype@npm:^4.0.0":
version: 4.0.0
resolution: "whatwg-mimetype@npm:4.0.0"
checksum: 894a618e2d90bf444b6f309f3ceb6e58cf21b2beaa00c8b333696958c4076f0c7b30b9d33413c9ffff7c5832a0a0c8569e5bb347ef44beded72aeefd0acd62e8
languageName: node
linkType: hard

"whatwg-url@npm:^10.0.0":
version: 10.0.0
resolution: "whatwg-url@npm:10.0.0"
Expand Down

0 comments on commit 08dfa94

Please sign in to comment.