diff --git a/.eslintrc b/.eslintrc index 2dbb39e4..8cae1be7 100755 --- a/.eslintrc +++ b/.eslintrc @@ -26,8 +26,7 @@ "no-console": "off", "no-debugger": "warn", "no-unused-expressions": "error", - "no-trailing-spaces": "error", + "no-trailing-spaces": "off", "no-undef": "error" - } } diff --git a/package-lock.json b/package-lock.json index a90db03e..94d1bc24 100755 --- a/package-lock.json +++ b/package-lock.json @@ -10,11 +10,11 @@ "license": "MIT", "devDependencies": { "@rollup/plugin-json": "^6.0.0", - "eslint": "^8.35.0", + "eslint": "^8.36.0", "husky": "^8.0.3", - "lint-staged": "^13.1.2", - "rimraf": "^4.3.0", - "rollup": "^3.18.0", + "lint-staged": "^13.2.0", + "rimraf": "^4.4.1", + "rollup": "^3.20.2", "rollup-plugin-baked-env": "^1.0.1", "rollup-plugin-banner2": "^1.2.2", "rollup-plugin-commonjs": "^10.1.0", @@ -26,15 +26,39 @@ "node": ">=18" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.1.tgz", + "integrity": "sha512-BISJ6ZE4xQsuL/FmsyRaiffpq977bMlsKfGHTQrOGFErfByxIe6iZTxPf/00Zon9b9a7iUykfQwejN3s2ZW/Bw==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.0.tgz", - "integrity": "sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.1.tgz", + "integrity": "sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", + "espree": "^9.5.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -50,9 +74,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.35.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.35.0.tgz", - "integrity": "sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==", + "version": "8.36.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.36.0.tgz", + "integrity": "sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -175,9 +199,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.14.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz", - "integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==", + "version": "18.15.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.10.tgz", + "integrity": "sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ==", "dev": true }, "node_modules/@types/resolve": { @@ -432,12 +456,12 @@ "dev": true }, "node_modules/commander": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", - "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz", + "integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==", "dev": true, "engines": { - "node": "^12.20.0 || >=14" + "node": ">=14" } }, "node_modules/concat-map": { @@ -447,9 +471,9 @@ "dev": true }, "node_modules/core-js": { - "version": "3.29.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.29.0.tgz", - "integrity": "sha512-VG23vuEisJNkGl6XQmFJd3rEG/so/CNatqeE+7uZAwTSwFeB/qaO0be8xZYUNWprJ/GIwL8aMt9cj1kvbpTZhg==", + "version": "3.29.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.29.1.tgz", + "integrity": "sha512-+jwgnhg6cQxKYIIjGtAHq2nwUOolo9eoFZ4sHfUH09BLXBgxnH4gA0zEd+t+BO2cNB8idaBtZFcFTRjQJRJmAw==", "dev": true, "hasInstallScript": true, "funding": { @@ -531,13 +555,15 @@ } }, "node_modules/eslint": { - "version": "8.35.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.35.0.tgz", - "integrity": "sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==", + "version": "8.36.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.36.0.tgz", + "integrity": "sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^2.0.0", - "@eslint/js": "8.35.0", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.1", + "@eslint/js": "8.36.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -548,9 +574,8 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", + "espree": "^9.5.0", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -572,7 +597,6 @@ "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" @@ -600,33 +624,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-visitor-keys": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", @@ -637,9 +634,9 @@ } }, "node_modules/espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.0.tgz", + "integrity": "sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw==", "dev": true, "dependencies": { "acorn": "^8.8.0", @@ -702,14 +699,14 @@ } }, "node_modules/execa": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", - "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.1", - "human-signals": "^3.0.1", + "human-signals": "^4.3.0", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.1.0", @@ -718,7 +715,7 @@ "strip-final-newline": "^3.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" }, "funding": { "url": "https://github.com/sindresorhus/execa?sponsor=1" @@ -804,26 +801,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/flat-cache/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/flat-cache/node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -884,18 +861,20 @@ } }, "node_modules/glob": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-9.2.1.tgz", - "integrity": "sha512-Pxxgq3W0HyA3XUvSXcFhRSs+43Jsx0ddxcFrbjxNGkL2Ak5BAUBxLqI5G6ADDeCHLfzzXFhe0b1yYcctGmytMA==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", - "minimatch": "^7.4.1", - "minipass": "^4.2.4", - "path-scurry": "^1.6.1" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -913,30 +892,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.2.tgz", - "integrity": "sha512-xy4q7wou3vUoC9k1xGTXc+awNdGaGVHtFUaey8tiX4H1QRc04DZ/rmDFwNm2EBsuYEhAZ6SgMmYf3InGY6OauA==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/globals": { "version": "13.20.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", @@ -980,12 +935,12 @@ } }, "node_modules/human-signals": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", - "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", "dev": true, "engines": { - "node": ">=12.20.0" + "node": ">=14.18.0" } }, "node_modules/husky": { @@ -1159,9 +1114,9 @@ "dev": true }, "node_modules/js-sdsl": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", - "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", + "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", "dev": true, "funding": { "type": "opencollective", @@ -1206,33 +1161,33 @@ } }, "node_modules/lilconfig": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", - "integrity": "sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/lint-staged": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.1.2.tgz", - "integrity": "sha512-K9b4FPbWkpnupvK3WXZLbgu9pchUJ6N7TtVZjbaPsoizkqFUDkUReUL25xdrCljJs7uLUF3tZ7nVPeo/6lp+6w==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.0.tgz", + "integrity": "sha512-GbyK5iWinax5Dfw5obm2g2ccUiZXNGtAS4mCbJ0Lv4rq6iEtfBSjOYdcbOtAIFtM114t0vdpViDDetjVTSd8Vw==", "dev": true, "dependencies": { + "chalk": "5.2.0", "cli-truncate": "^3.1.0", - "colorette": "^2.0.19", - "commander": "^9.4.1", + "commander": "^10.0.0", "debug": "^4.3.4", - "execa": "^6.1.0", - "lilconfig": "2.0.6", - "listr2": "^5.0.5", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", - "object-inspect": "^1.12.2", + "object-inspect": "^1.12.3", "pidtree": "^0.6.0", "string-argv": "^0.3.1", - "yaml": "^2.1.3" + "yaml": "^2.2.1" }, "bin": { "lint-staged": "bin/lint-staged.js" @@ -1244,10 +1199,22 @@ "url": "https://opencollective.com/lint-staged" } }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/listr2": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.7.tgz", - "integrity": "sha512-MD+qXHPmtivrHIDRwPYdfNkrzqDiuaKU/rfBcec3WMyMF3xylQj3jMq344OtvQxz7zaCFViRAeqlr2AFhPvXHw==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", "dev": true, "dependencies": { "cli-truncate": "^2.1.0", @@ -1430,9 +1397,9 @@ } }, "node_modules/lru-cache": { - "version": "7.18.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.1.tgz", - "integrity": "sha512-8/HcIENyQnfUTCDizRu9rrDyG6XG/21M4X7/YEGZeD76ZJilFPAUVb/2zysFf7VVO1LEjCDFyHp8pMMvozIrvg==", + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "dev": true, "engines": { "node": ">=12" @@ -1503,9 +1470,9 @@ } }, "node_modules/minipass": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.4.tgz", - "integrity": "sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ==", + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz", + "integrity": "sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==", "dev": true, "engines": { "node": ">=8" @@ -1709,16 +1676,16 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.1.tgz", - "integrity": "sha512-OW+5s+7cw6253Q4E+8qQ/u1fVvcJQCJo/VFD8pje+dbJCF1n5ZRMV2AEHbGp+5Q7jxQIYJxkHopnj6nzdGeZLA==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.3.tgz", + "integrity": "sha512-RAmB+n30SlN+HnNx6EbcpoDy9nwdpcGPnEKrJnu6GZoDWBdIjo1UQMVtW2ybtC7LC2oKLcMq8y5g8WnKLiod9g==", "dev": true, "dependencies": { "lru-cache": "^7.14.1", "minipass": "^4.0.2" }, "engines": { - "node": ">=14" + "node": ">=16 || 14 >=14.17" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -1786,18 +1753,6 @@ } ] }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, "node_modules/resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", @@ -1878,9 +1833,9 @@ "dev": true }, "node_modules/rimraf": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.3.0.tgz", - "integrity": "sha512-5qVDXPbByA1qSJEWMv1qAwKsoS22vVpsL2QyxCKBw4gf6XiFo1K3uRLY6uSOOBFDwnqAZtnbILqWKKlzh8bkGg==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.4.1.tgz", + "integrity": "sha512-Gk8NlF062+T9CqNGn6h4tls3k6T1+/nXdOcSZVikNVtlRdYpA7wRJJMoXmuvOnLW844rPjdQ7JgXCYM6PPC/og==", "dev": true, "dependencies": { "glob": "^9.2.0" @@ -1895,10 +1850,52 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.2.tgz", + "integrity": "sha512-BTv/JhKXFEHsErMte/AnfiSv8yYOLLiyH2lTg8vn02O21zWFgHPTfxtgn1QRe7NRgggUhC8hacR2Re94svHqeA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "minimatch": "^7.4.1", + "minipass": "^4.2.4", + "path-scurry": "^1.6.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.3.tgz", + "integrity": "sha512-5UB4yYusDtkRPbRiy1cqZ1IpGNcJCGlEMG17RKzPddpyiPKoCdwohbED8g4QXT0ewCt8LTkQXuljsUfQ3FKM4A==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/rollup": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.18.0.tgz", - "integrity": "sha512-J8C6VfEBjkvYPESMQYxKHxNOh4A5a3FlP+0BETGo34HEcE4eTlgCrO2+eWzlu2a/sHs2QUkZco+wscH7jhhgWg==", + "version": "3.20.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.2.tgz", + "integrity": "sha512-3zwkBQl7Ai7MFYQE0y1MeQ15+9jsi7XxfrqwTb/9EK8D9C9+//EBR4M+CuA1KODRaNbFez/lWxA5vhEGZp4MUg==", "dev": true, "bin": { "rollup": "dist/bin/rollup" diff --git a/package.json b/package.json index d0f922ff..ac2bd0fa 100755 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "https://*.discord.com/channels/*", "https://*.discord.com/login" ], - "icon":"https://victornpb.github.io/undiscord/images/icon128.png", + "icon": "https://victornpb.github.io/undiscord/images/icon128.png", "downloadURL": "https://raw.githubusercontent.com/victornpb/deleteDiscordMessages/master/deleteDiscordMessages.user.js", "contributionURL": "https://www.buymeacoffee.com/vitim", "grant": "none" @@ -36,7 +36,8 @@ "prebuild": "rimraf dist", "test": "npm run lint && npm run build", "lint": "eslint src", - "lint:fix": "eslint src --fix" + "lint:fix": "eslint src --fix", + "version": "npm run build" }, "files": [ "dist" @@ -52,11 +53,11 @@ ], "devDependencies": { "@rollup/plugin-json": "^6.0.0", - "eslint": "^8.35.0", + "eslint": "^8.36.0", "husky": "^8.0.3", - "lint-staged": "^13.1.2", - "rimraf": "^4.3.0", - "rollup": "^3.18.0", + "lint-staged": "^13.2.0", + "rimraf": "^4.4.1", + "rollup": "^3.20.2", "rollup-plugin-baked-env": "^1.0.1", "rollup-plugin-banner2": "^1.2.2", "rollup-plugin-commonjs": "^10.1.0", @@ -68,5 +69,8 @@ "hooks": { "pre-commit": "lint-staged" } + }, + "lint-staged":{ + "src/**.js": "npm run lint" } } diff --git a/src/ui/theme.css b/src/ui/theme.css index b937325e..3fb16919 100644 --- a/src/ui/theme.css +++ b/src/ui/theme.css @@ -269,6 +269,7 @@ color: transparent !important; background-color: var(--primary-700) !important; cursor: default; + user-select: none; } #undiscord.redact x:hover { diff --git a/src/ui/undiscord.html b/src/ui/undiscord.html index 2c9f8c4e..455d9e70 100644 --- a/src/ui/undiscord.html +++ b/src/ui/undiscord.html @@ -178,7 +178,7 @@

Undiscord

help
- +
@@ -188,7 +188,7 @@

Undiscord

help
- +

@@ -197,6 +197,19 @@

Undiscord

Use the help link for more information. +
+
+ + Authorization Token + help + +
+
+ +
+ +
+

@@ -221,6 +234,7 @@

Undiscord

+                
Notice: Undiscord may be working slower than usual andrequire multiple attempts due to a recent Discord update.
We're working on a fix, and we thank you for your patience.
Star this project on GitHub!
Issues or help
diff --git a/src/undiscord-core.js b/src/undiscord-core.js index 96ac61f4..d364932c 100644 --- a/src/undiscord-core.js +++ b/src/undiscord-core.js @@ -134,6 +134,7 @@ class UndiscordCore { log.verb('Fetching messages...'); // Search messages await this.search(); + // Process results and find which messages should be deleted await this.filterResponse(); @@ -170,11 +171,15 @@ class UndiscordCore { } else { log.verb('Ended because API returned an empty page.'); - if (this.state.grandTotal - this.state.offset > 0) log.warn('[End condition A].', this.state); // I don't remember why this was here. (looks like messagesToDelete==0 && skippedMessages==0 is enough - else log.warn('[End condition B] if you see this please report.', this.state); + log.verb('[End state]', this.state); if (isJob) break; // break without stopping if this is part of a job this.state.running = false; } + + // wait before next page (fix search page not updating fast enough) + log.verb(`Waiting ${(this.options.searchDelay/1000).toFixed(2)}s before next page...`); + await wait(this.options.searchDelay); + } while (this.state.running); this.stats.endTime = new Date(); @@ -187,6 +192,7 @@ class UndiscordCore { stop() { this.state.running = false; + if (this.onStop) this.onStop(this.state, this.stats); } /** Calculate the estimated time remaining based on the current stats */ @@ -247,12 +253,14 @@ class UndiscordCore { this.afterRequest(); } catch (err) { this.state.running = false; - return log.error('Search request threw an error:', err); + log.error('Search request threw an error:', err); + throw err; } // not indexed yet if (resp.status === 202) { - const w = (await resp.json()).retry_after * 1000; + let w = (await resp.json()).retry_after * 1000; + w = w || this.stats.searchDelay; // Fix retry_after 0 this.stats.throttledCount++; this.stats.throttledTotalTime += w; log.warn(`This channel isn't indexed yet. Waiting ${w}ms for discord to index it...`); @@ -263,19 +271,24 @@ class UndiscordCore { if (!resp.ok) { // searching messages too fast if (resp.status === 429) { - const w = (await resp.json()).retry_after * 1000; + let w = (await resp.json()).retry_after * 1000; + w = w || this.stats.searchDelay; // Fix retry_after 0 + this.stats.throttledCount++; this.stats.throttledTotalTime += w; this.stats.searchDelay += w; // increase delay + w = this.stats.searchDelay; log.warn(`Being rate limited by the API for ${w}ms! Increasing search delay...`); this.printStats(); log.verb(`Cooling down for ${w * 2}ms before retrying...`); await wait(w * 2); return await this.search(); - } else { + } + else { this.state.running = false; - return log.error(`Error searching messages, API responded with status ${resp.status}!\n`, await resp.json()); + log.error(`Error searching messages, API responded with status ${resp.status}!\n`, await resp.json()); + throw resp; } } const data = await resp.json(); diff --git a/src/undiscord-ui.js b/src/undiscord-ui.js index 7ce3c956..ec0a59b4 100644 --- a/src/undiscord-ui.js +++ b/src/undiscord-ui.js @@ -13,7 +13,7 @@ import Drag from './utils/drag'; import createElm from './utils/createElm'; import insertCss from './utils/insertCss'; import messagePicker from './utils/messagePicker'; -import { getToken, getAuthorId, getGuildId, getChannelId } from './utils/getIds'; +import { getAuthorId, getGuildId, getChannelId, fillToken } from './utils/getIds'; import { log, setLogFn } from './utils/log.js'; import { replaceInterpolations, msToHMS } from './utils/helpers'; @@ -115,7 +115,6 @@ function initUI() { const b = ui.undiscordWindow.classList.toggle('redact'); if (b) alert('This mode will attempt to hide personal information, so you can screen share / take screenshots.\nAlways double check you are not sharing sensitive information!'); }; - $('#pickMessageAfter').onclick = async () => { alert('Select a message on the chat.\nThe message below it will be deleted.'); toggleWindow(); @@ -130,7 +129,7 @@ function initUI() { if (id) $('input#maxId').value = id; toggleWindow(); }; - + $('button#getToken').onclick = () => $('input#token').value = fillToken(); // sync delays $('input#searchDelay').onchange = (e) => { @@ -149,12 +148,8 @@ function initUI() { $('div#deleteDelayValue').textContent = event.target.value + 'ms'; }); - // import json const fileSelection = $('input#importJsonInput'); - // $('button#importJsonBtn').onclick = () => { - // fileSelection.click(); - // }; fileSelection.onchange = async () => { const files = fileSelection.files; @@ -191,6 +186,7 @@ function initUI() { function printLog(type = '', args) { ui.logArea.insertAdjacentHTML('beforeend', `
${Array.from(args).map(o => typeof o === 'object' ? JSON.stringify(o, o instanceof Error && Object.getOwnPropertyNames(o)) : o).join('\t')}
`); if (ui.autoScroll.checked) ui.logArea.querySelector('div:last-child').scrollIntoView(false); + if (type==='error') console.error(PREFIX, ...Array.from(args)); } function setupUndiscordCore() { @@ -206,7 +202,7 @@ function setupUndiscordCore() { }; undiscordCore.onProgress = (state, stats) => { - console.log(PREFIX, 'onProgress', state, stats); + // console.log(PREFIX, 'onProgress', state, stats); let max = state.grandTotal; const value = state.delCount + state.failCount; max = Math.max(max, value, 0); // clamp max @@ -252,15 +248,7 @@ function setupUndiscordCore() { async function startAction() { console.log(PREFIX, 'startAction'); - // general - let authToken; - try { - authToken = getToken(); - } catch (err) { - console.error(err); - log.error(err); - } const authorId = $('input#authorId').value.trim(); const guildId = $('input#guildId').value.trim(); const channelIds = $('input#channelId').value.trim().split(/\s*,\s*/); @@ -280,14 +268,17 @@ async function startAction() { //advanced const searchDelay = parseInt($('input#searchDelay').value.trim()); const deleteDelay = parseInt($('input#deleteDelay').value.trim()); - + + // token + const authToken = $('input#token').value.trim() || fillToken(); + if (!authToken) return; // get token already logs an error. + + // validate input + if (!guildId) return log.error('You must fill the "Server ID" field!'); + // clear logArea ui.logArea.innerHTML = ''; - // validate input - if (!authToken) return log.error('Could not detect the authorization token!') || log.info('Please make sure Undiscord is up to date'); - else if (!guildId) return log.error('You must provide a Server ID!'); - undiscordCore.resetState(); undiscordCore.options = { ...undiscordCore.options, @@ -318,10 +309,9 @@ async function startAction() { })); try { - undiscordCore.runBatch(jobs); + await undiscordCore.runBatch(jobs); } catch (err) { - console.error(err); - log.error(err); + log.error('CoreException', err); } } // multiple channels @@ -332,19 +322,18 @@ async function startAction() { })); try { - undiscordCore.runBatch(jobs); + await undiscordCore.runBatch(jobs); } catch (err) { - console.error(err); - log.error(err); + log.error('CoreException', err); } } // single channel else { try { - undiscordCore.run(); + await undiscordCore.run(); } catch (err) { - console.error(err); - log.error(err); + log.error('CoreException', err); + undiscordCore.stop(); } } } diff --git a/src/utils/getIds.js b/src/utils/getIds.js index dd9e81cf..4adbab22 100644 --- a/src/utils/getIds.js +++ b/src/utils/getIds.js @@ -1,3 +1,5 @@ +import { log } from './log'; + export function getToken() { window.dispatchEvent(new Event('beforeunload')); const LS = document.body.appendChild(document.createElement('iframe')).contentWindow.localStorage; @@ -12,11 +14,23 @@ export function getAuthorId() { export function getGuildId() { const m = location.href.match(/channels\/([\w@]+)\/(\d+)/); if (m) return m[1]; - else alert('Could not the Guild ID!\nPlease make sure you are on a Server or DM.'); + else alert('Could not find the Guild ID!\nPlease make sure you are on a Server or DM.'); } export function getChannelId() { const m = location.href.match(/channels\/([\w@]+)\/(\d+)/); if (m) return m[2]; - else alert('Could not the Channel ID!\nPlease make sure you are on a Channel or DM.'); + else alert('Could not find the Channel ID!\nPlease make sure you are on a Channel or DM.'); +} + +export function fillToken() { + try { + return getToken(); + } catch (err) { + log.verb(err); + log.error('Could not automatically detect Authorization Token!'); + log.info('Please make sure Undiscord is up to date'); + log.debug('Alternatively, you can try entering a Token manually in the "Advanced Settings" section.'); + } + return ''; }