diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f58928..aaa31bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,11 +40,6 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - # Uninstall nodejieba for the moment, as it's not compatible with Node 18 on Windows. - # TODO: Remove this once a new version of nodejieba is released (the fix is already on its master branch). - - run: npm uninstall --ignore-scripts --save -w packages/docusaurus-search-local nodejieba - if: runner.os == 'Windows' && (matrix.node-version == '18.x' || matrix.node-version == '20.x' || matrix.node-version == '22.x') - - run: npm ci - run: npm run lint diff --git a/README.md b/README.md index 84336c1..1599ae8 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ The following languages are available: ar, da, de, en, es, fi, fr, hi, hu, it, ja, nl, no, pt, ro, ru, sv, th, tr, vi, zh -**Important: For Chinese language support (`zh`), you also have to install the `nodejieba` npm package at `^2.5.0`.** +**Important: For Chinese language support (`zh`), you also have to install the `nodejieba` npm package at `^2.5.0 || ^3.0.0`.** ### Documentation Versions diff --git a/package-lock.json b/package-lock.json index ba87e27..228bc0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6044,20 +6044,24 @@ } }, "node_modules/cheerio": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", - "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", + "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", "dependencies": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" + "domutils": "^3.1.0", + "encoding-sniffer": "^0.2.0", + "htmlparser2": "^9.1.0", + "parse5": "^7.1.2", + "parse5-htmlparser2-tree-adapter": "^7.0.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^6.19.5", + "whatwg-mimetype": "^4.0.0" }, "engines": { - "node": ">= 6" + "node": ">=18.17" }, "funding": { "url": "https://github.com/cheeriojs/cheerio?sponsor=1" @@ -8108,13 +8112,13 @@ } }, "node_modules/domutils": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz", - "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", "dependencies": { "dom-serializer": "^2.0.0", "domelementtype": "^2.3.0", - "domhandler": "^5.0.1" + "domhandler": "^5.0.3" }, "funding": { "url": "https://github.com/fb55/domutils?sponsor=1" @@ -8280,6 +8284,29 @@ "node": ">= 0.8" } }, + "node_modules/encoding-sniffer": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", + "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, + "node_modules/encoding-sniffer/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -8313,9 +8340,9 @@ } }, "node_modules/entities": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", - "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "engines": { "node": ">=0.12" }, @@ -10189,9 +10216,9 @@ } }, "node_modules/htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", + "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", "funding": [ "https://github.com/fb55/htmlparser2?sponsor=1", { @@ -10202,8 +10229,8 @@ "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" + "domutils": "^3.1.0", + "entities": "^4.5.0" } }, "node_modules/http-cache-semantics": { @@ -13311,13 +13338,13 @@ "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==" }, "node_modules/nodejieba": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/nodejieba/-/nodejieba-2.6.0.tgz", - "integrity": "sha512-cyEOLRGLjDuxbTuv6nuMAK3NpML4ft9i7st98TFHvXtg+m3RFhIuf4INBHGp3VhUaqPsCTfAkhHB/ZNTFiwJjg==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/nodejieba/-/nodejieba-3.4.3.tgz", + "integrity": "sha512-OZnhxsy25k5XRBqI2UUjSu6k3a1+5U9PGm/JMWs949D2HCLfwdt9XIJ0B4YF2ZVQakNKqBUR37Vn5L/9lf4gYg==", "dev": true, "hasInstallScript": true, "dependencies": { - "@mapbox/node-pre-gyp": "^1.0.4", + "@mapbox/node-pre-gyp": "^1.0.9", "node-addon-api": "^3.0.2" }, "engines": { @@ -13916,6 +13943,17 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "dependencies": { + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -17871,9 +17909,9 @@ } }, "node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -17923,6 +17961,14 @@ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", "dev": true }, + "node_modules/undici": { + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz", + "integrity": "sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==", + "engines": { + "node": ">=18.17" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -19372,7 +19418,7 @@ "@algolia/autocomplete-theme-classic": "^1.8.2", "@algolia/client-search": "^4.12.0", "algoliasearch": "^4.12.0", - "cheerio": "^1.0.0-rc.9", + "cheerio": "^1.0.0", "clsx": "^1.1.1", "lunr-languages": "^1.4.0", "mark.js": "^8.11.1", @@ -19408,16 +19454,16 @@ "concurrently": "^7.0.0", "copyfiles": "^2.4.1", "jest": "^29.4.3", - "nodejieba": "^2.5.0", + "nodejieba": "^2.5.0 || ^3.0.0", "nodemon": "^2.0.15", "playwright": "^1.31.1", "react": "^17.0.0", "react-dom": "^17.0.0", - "typescript": "^4.9.4" + "typescript": "^5.0.0" }, "peerDependencies": { "@docusaurus/core": "^2.0.0", - "nodejieba": "^2.5.0" + "nodejieba": "^2.5.0 || ^3.0.0" }, "peerDependenciesMeta": { "nodejieba": { @@ -19425,19 +19471,6 @@ } } }, - "packages/docusaurus-search-local/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "packages/example-docs": { "dependencies": { "@cmfcmf/docusaurus-search-local": "*", @@ -20935,28 +20968,20 @@ "@types/rtlcss": "^3.1.2", "algoliasearch": "^4.12.0", "babel-jest": "^29.4.3", - "cheerio": "^1.0.0-rc.9", + "cheerio": "^1.0.0", "clsx": "^1.1.1", "concurrently": "^7.0.0", "copyfiles": "^2.4.1", "jest": "^29.4.3", "lunr-languages": "^1.4.0", "mark.js": "^8.11.1", - "nodejieba": "^2.5.0", + "nodejieba": "^2.5.0 || ^3.0.0", "nodemon": "^2.0.15", "playwright": "^1.31.1", "react": "^17.0.0", "react-dom": "^17.0.0", "tslib": "^2.6.3", - "typescript": "^4.9.4" - }, - "dependencies": { - "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true - } + "typescript": "^5.0.0" } }, "@colors/colors": { @@ -24067,17 +24092,21 @@ "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==" }, "cheerio": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", - "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", + "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", "requires": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" + "domutils": "^3.1.0", + "encoding-sniffer": "^0.2.0", + "htmlparser2": "^9.1.0", + "parse5": "^7.1.2", + "parse5-htmlparser2-tree-adapter": "^7.0.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^6.19.5", + "whatwg-mimetype": "^4.0.0" } }, "cheerio-select": { @@ -25529,13 +25558,13 @@ } }, "domutils": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz", - "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", "requires": { "dom-serializer": "^2.0.0", "domelementtype": "^2.3.0", - "domhandler": "^5.0.1" + "domhandler": "^5.0.3" } }, "dot-case": { @@ -25660,6 +25689,25 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==" }, + "encoding-sniffer": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", + "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "requires": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "dependencies": { + "iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + } + } + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -25687,9 +25735,9 @@ } }, "entities": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", - "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==" + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==" }, "env-paths": { "version": "2.2.1", @@ -27097,14 +27145,14 @@ } }, "htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", + "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", "requires": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" + "domutils": "^3.1.0", + "entities": "^4.5.0" } }, "http-cache-semantics": { @@ -29269,12 +29317,12 @@ "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==" }, "nodejieba": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/nodejieba/-/nodejieba-2.6.0.tgz", - "integrity": "sha512-cyEOLRGLjDuxbTuv6nuMAK3NpML4ft9i7st98TFHvXtg+m3RFhIuf4INBHGp3VhUaqPsCTfAkhHB/ZNTFiwJjg==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/nodejieba/-/nodejieba-3.4.3.tgz", + "integrity": "sha512-OZnhxsy25k5XRBqI2UUjSu6k3a1+5U9PGm/JMWs949D2HCLfwdt9XIJ0B4YF2ZVQakNKqBUR37Vn5L/9lf4gYg==", "dev": true, "requires": { - "@mapbox/node-pre-gyp": "^1.0.4", + "@mapbox/node-pre-gyp": "^1.0.9", "node-addon-api": "^3.0.2" } }, @@ -29707,6 +29755,14 @@ "parse5": "^7.0.0" } }, + "parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "requires": { + "parse5": "^7.0.0" + } + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -32525,9 +32581,9 @@ } }, "typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==" + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==" }, "ua-parser-js": { "version": "1.0.38", @@ -32547,6 +32603,11 @@ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", "dev": true }, + "undici": { + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz", + "integrity": "sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==" + }, "undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", diff --git a/packages/docusaurus-search-local/package.json b/packages/docusaurus-search-local/package.json index 4af9a0a..baaf3f4 100644 --- a/packages/docusaurus-search-local/package.json +++ b/packages/docusaurus-search-local/package.json @@ -29,7 +29,7 @@ "@algolia/autocomplete-theme-classic": "^1.8.2", "@algolia/client-search": "^4.12.0", "algoliasearch": "^4.12.0", - "cheerio": "^1.0.0-rc.9", + "cheerio": "^1.0.0", "clsx": "^1.1.1", "lunr-languages": "^1.4.0", "mark.js": "^8.11.1", @@ -37,7 +37,7 @@ }, "peerDependencies": { "@docusaurus/core": "^2.0.0", - "nodejieba": "^2.5.0" + "nodejieba": "^2.5.0 || ^3.0.0" }, "peerDependenciesMeta": { "nodejieba": { @@ -74,12 +74,12 @@ "concurrently": "^7.0.0", "copyfiles": "^2.4.1", "jest": "^29.4.3", - "nodejieba": "^2.5.0", + "nodejieba": "^2.5.0 || ^3.0.0", "nodemon": "^2.0.15", "playwright": "^1.31.1", "react": "^17.0.0", "react-dom": "^17.0.0", - "typescript": "^4.9.4" + "typescript": "^5.0.0" }, "scripts": { "build:client": "tsc --project tsconfig.client.json && copyfiles --up 1 src/client/**/*.css lib", diff --git a/packages/docusaurus-search-local/src/client/theme/SearchBar/index.tsx b/packages/docusaurus-search-local/src/client/theme/SearchBar/index.tsx index 7d91b9f..8683f67 100644 --- a/packages/docusaurus-search-local/src/client/theme/SearchBar/index.tsx +++ b/packages/docusaurus-search-local/src/client/theme/SearchBar/index.tsx @@ -149,10 +149,11 @@ const SearchBar = () => { const index = await fetchIndex(baseUrl, tag); callbacks.forEach((cb) => cb(index)); - return (indexes.current[tag] = { + indexes.current[tag] = { state: "ready", ...index, - }); + }; + return index; } case "loading": return new Promise((resolve) => { diff --git a/packages/docusaurus-search-local/src/server/parse.ts b/packages/docusaurus-search-local/src/server/parse.ts index e9a4a75..9f8e4ce 100644 --- a/packages/docusaurus-search-local/src/server/parse.ts +++ b/packages/docusaurus-search-local/src/server/parse.ts @@ -1,4 +1,4 @@ -import cheerio from "cheerio"; +import * as cheerio from "cheerio"; import logger from "./logger"; // We insert whitespace after text from any of these tags @@ -42,7 +42,7 @@ const BLOCK_TAGS = [ "th", ]; -function _getText($: ReturnType, el: any | any[]): string { +function _getText($: cheerio.CheerioAPI, el: any | any[]): string { if (Array.isArray(el)) { let content = ""; el.forEach((el) => { @@ -71,7 +71,7 @@ function _getText($: ReturnType, el: any | any[]): string { } } -function getText($: ReturnType, el: any | any[]): string { +function getText($: cheerio.CheerioAPI, el: any | any[]): string { return _getText($, el).replace(/\s+/g, " ").trim(); } diff --git a/packages/docusaurus-search-local/tsconfig.client.json b/packages/docusaurus-search-local/tsconfig.client.json index 8ede2e5..4682f79 100644 --- a/packages/docusaurus-search-local/tsconfig.client.json +++ b/packages/docusaurus-search-local/tsconfig.client.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "target": "ESNext", + "moduleResolution": "Bundler", "module": "ESNext", "lib": ["ESNext", "DOM"], "allowJs": true diff --git a/packages/docusaurus-search-local/tsconfig.json b/packages/docusaurus-search-local/tsconfig.json index 86640eb..8e6e6b6 100644 --- a/packages/docusaurus-search-local/tsconfig.json +++ b/packages/docusaurus-search-local/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "ESNext", - "module": "CommonJS", + "module": "Node16", "lib": ["ESNext", "DOM"], // Declarations break Docusaurus' 'write-translations' command (#163, #129, #145) @@ -26,7 +26,7 @@ "noUnusedParameters": true, /* Module Resolution Options */ - "moduleResolution": "nodenext", + "moduleResolution": "NodeNext", "allowSyntheticDefaultImports": true, "esModuleInterop": true, diff --git a/packages/docusaurus-search-local/tsconfig.server.json b/packages/docusaurus-search-local/tsconfig.server.json index cd16819..9584a0c 100644 --- a/packages/docusaurus-search-local/tsconfig.server.json +++ b/packages/docusaurus-search-local/tsconfig.server.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "target": "ESNext", - "module": "CommonJS", + "module": "NodeNext", "lib": ["ESNext", "DOM"] }, "include": ["src/server/**/*"]