diff --git a/.eslintrc.json b/.eslintrc.json index 751bf56d95..3c5ef7d76c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,7 +16,7 @@ }, "parserOptions": { "sourceType": "module", - "ecmaVersion": 2018, + "ecmaVersion": 2021, "ecmaFeatures": { "globalReturn": true } diff --git a/CHANGELOG.md b/CHANGELOG.md index 46258264b7..58fb6a9b10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ Special thanks to the following contributors: @AmpioRosso, @eouia, @fewieden, @j - Added missing shebang to `installers/mm.sh`. - Node versions in templates and github workflows. - Updated translations for Traditional Chinese (Taiwan) (zh-tw.json). +- Switch from `node-fetch` to `node-fetch-commonjs` (#2649) ### Fixed diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index f27025d778..297ca4badb 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -8,7 +8,7 @@ const CalendarUtils = require("./calendarutils"); const Log = require("logger"); const NodeHelper = require("node_helper"); const ical = require("node-ical"); -const fetch = require("node-fetch"); +const fetch = require("node-fetch-commonjs"); const digest = require("digest-fetch"); const https = require("https"); diff --git a/modules/default/newsfeed/newsfeedfetcher.js b/modules/default/newsfeed/newsfeedfetcher.js index dc69e4ce03..ee58335f58 100644 --- a/modules/default/newsfeed/newsfeedfetcher.js +++ b/modules/default/newsfeed/newsfeedfetcher.js @@ -7,7 +7,7 @@ const Log = require("logger"); const FeedMe = require("feedme"); const NodeHelper = require("node_helper"); -const fetch = require("node-fetch"); +const fetch = require("node-fetch-commonjs"); const iconv = require("iconv-lite"); /** diff --git a/package-lock.json b/package-lock.json index 739a70f88e..bef78e7c71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "iconv-lite": "^0.6.3", "module-alias": "^2.2.2", "moment": "^2.29.1", - "node-fetch": "^2.6.7", + "node-fetch-commonjs": "^3.1.1", "node-ical": "^0.13.0", "socket.io": "^4.4.1" }, @@ -1068,9 +1068,9 @@ } }, "node_modules/@sinonjs/samsam": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.0.tgz", - "integrity": "sha512-ue6oFxsnGcvB46dUDu+EjyBxaqvDYMl6ufysVdGfYpCZwaQgZpHbtj7UxpNbEm8K7iGnwzworZAS6ylZsU5lgQ==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.1.tgz", + "integrity": "sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==", "dev": true, "dependencies": { "@sinonjs/commons": "^1.6.0", @@ -1274,6 +1274,25 @@ "@types/node": "*" } }, + "node_modules/@typescript-eslint/experimental-utils": { + "version": "5.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.10.1.tgz", + "integrity": "sha512-Ryeb8nkJa/1zKl8iujNtJC8tgj6PgaY0sDUnrTqbmC70nrKKkZaHfiRDTcqICmCSCEQyLQcJAoh0AukLaIaGTw==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "5.10.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "5.10.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.1.tgz", @@ -2852,9 +2871,9 @@ } }, "node_modules/eslint": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.7.0.tgz", - "integrity": "sha512-ifHYzkBGrzS2iDU7KjhCAVMGCvF6M3Xfs8X8b37cgrUlDt6bWRTpRh6T/gtSXv1HJ/BUGgmjvNvOEGu85Iif7w==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.8.0.tgz", + "integrity": "sha512-H3KXAzQGBH1plhYS3okDix2ZthuYJlQQEGE5k0IKuEqUSiyu4AmxxlJ2MtTYeJ3xB4jDhcYCwGOg2TXYdnDXlQ==", "dependencies": { "@eslint/eslintrc": "^1.0.5", "@humanwhocodes/config-array": "^0.9.2", @@ -3041,6 +3060,14 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/eslint/node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "engines": { + "node": ">= 4" + } + }, "node_modules/espree": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", @@ -3384,6 +3411,28 @@ "node": ">=10" } }, + "node_modules/fetch-blob": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.4.tgz", + "integrity": "sha512-Eq5Xv5+VlSrYWEqKrusxY1C3Hm/hjeAsCGVG3ft7pZahlUAChpGZT/Ms1WmSLnEAisEXszjzu/s+ce6HZB2VHA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -3511,6 +3560,17 @@ "node": ">= 6" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -5899,6 +5959,24 @@ "isarray": "0.0.1" } }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -5918,6 +5996,22 @@ } } }, + "node_modules/node-fetch-commonjs": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/node-fetch-commonjs/-/node-fetch-commonjs-3.1.1.tgz", + "integrity": "sha512-TgkdVJdiEaauzWwB9NoD4TvHZFtG6KKEffvotWf9WNIyoRZHsCFjGfb3bhkIXrMt3YFgFi8ZApbwWoe1h3XTpA==", + "dependencies": { + "formdata-polyfill": "^4.0.10", + "web-streams-polyfill": "^3.1.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, "node_modules/node-fetch/node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -6470,13 +6564,13 @@ } }, "node_modules/playwright": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.18.0.tgz", - "integrity": "sha512-GOWvcWRtL7o6QCj6tvZCxqHKx2sIhXeEmEJAqQdOZgxzQiCkPe1hnTHab1p8R1bDvHK703fDS2oIbs3mcvg6gw==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.18.1.tgz", + "integrity": "sha512-8EaX9EtbtAoMq5tnzIsoA3b/V86V/6Mq2skuOU4qEw+5OVxs1lwesDwmjy/RVU1Qfx5UuwSQzhp45wyH22oa+A==", "dev": true, "hasInstallScript": true, "dependencies": { - "playwright-core": "=1.18.0" + "playwright-core": "=1.18.1" }, "bin": { "playwright": "cli.js" @@ -6486,9 +6580,9 @@ } }, "node_modules/playwright-core": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.18.0.tgz", - "integrity": "sha512-JTRlCVpfAFcC1nth+XIE07w6M5m6C8PaEoClv7wGWF97cyDMcHIij0xIVEKMKli7IG5N0mqjLDFc/akXSbMZ1g==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.18.1.tgz", + "integrity": "sha512-NALGl8R1GHzGLlhUApmpmfh6M1rrrPcDTygWvhTbprxwGB9qd/j9DRwyn4HTQcUB6o0/VOpo46fH9ez3+D/Rog==", "dev": true, "dependencies": { "commander": "^8.2.0", @@ -8454,6 +8548,14 @@ "makeerror": "1.0.12" } }, + "node_modules/web-streams-polyfill": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz", + "integrity": "sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==", + "engines": { + "node": ">= 8" + } + }, "node_modules/webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", @@ -9459,9 +9561,9 @@ } }, "@sinonjs/samsam": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.0.tgz", - "integrity": "sha512-ue6oFxsnGcvB46dUDu+EjyBxaqvDYMl6ufysVdGfYpCZwaQgZpHbtj7UxpNbEm8K7iGnwzworZAS6ylZsU5lgQ==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.1.tgz", + "integrity": "sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -9656,6 +9758,15 @@ "@types/node": "*" } }, + "@typescript-eslint/experimental-utils": { + "version": "5.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.10.1.tgz", + "integrity": "sha512-Ryeb8nkJa/1zKl8iujNtJC8tgj6PgaY0sDUnrTqbmC70nrKKkZaHfiRDTcqICmCSCEQyLQcJAoh0AukLaIaGTw==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "5.10.1" + } + }, "@typescript-eslint/scope-manager": { "version": "5.10.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.1.tgz", @@ -10845,9 +10956,9 @@ } }, "eslint": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.7.0.tgz", - "integrity": "sha512-ifHYzkBGrzS2iDU7KjhCAVMGCvF6M3Xfs8X8b37cgrUlDt6bWRTpRh6T/gtSXv1HJ/BUGgmjvNvOEGu85Iif7w==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.8.0.tgz", + "integrity": "sha512-H3KXAzQGBH1plhYS3okDix2ZthuYJlQQEGE5k0IKuEqUSiyu4AmxxlJ2MtTYeJ3xB4jDhcYCwGOg2TXYdnDXlQ==", "requires": { "@eslint/eslintrc": "^1.0.5", "@humanwhocodes/config-array": "^0.9.2", @@ -10884,6 +10995,13 @@ "strip-json-comments": "^3.1.0", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" + } } }, "eslint-config-prettier": { @@ -11254,6 +11372,15 @@ "sax": "^1.2.4" } }, + "fetch-blob": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.4.tgz", + "integrity": "sha512-Eq5Xv5+VlSrYWEqKrusxY1C3Hm/hjeAsCGVG3ft7pZahlUAChpGZT/Ms1WmSLnEAisEXszjzu/s+ce6HZB2VHA==", + "requires": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + } + }, "file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -11356,6 +11483,14 @@ "mime-types": "^2.1.12" } }, + "formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "requires": { + "fetch-blob": "^3.1.2" + } + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -13169,6 +13304,11 @@ } } }, + "node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" + }, "node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -13198,6 +13338,15 @@ } } }, + "node-fetch-commonjs": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/node-fetch-commonjs/-/node-fetch-commonjs-3.1.1.tgz", + "integrity": "sha512-TgkdVJdiEaauzWwB9NoD4TvHZFtG6KKEffvotWf9WNIyoRZHsCFjGfb3bhkIXrMt3YFgFi8ZApbwWoe1h3XTpA==", + "requires": { + "formdata-polyfill": "^4.0.10", + "web-streams-polyfill": "^3.1.1" + } + }, "node-ical": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/node-ical/-/node-ical-0.13.0.tgz", @@ -13612,18 +13761,18 @@ } }, "playwright": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.18.0.tgz", - "integrity": "sha512-GOWvcWRtL7o6QCj6tvZCxqHKx2sIhXeEmEJAqQdOZgxzQiCkPe1hnTHab1p8R1bDvHK703fDS2oIbs3mcvg6gw==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.18.1.tgz", + "integrity": "sha512-8EaX9EtbtAoMq5tnzIsoA3b/V86V/6Mq2skuOU4qEw+5OVxs1lwesDwmjy/RVU1Qfx5UuwSQzhp45wyH22oa+A==", "dev": true, "requires": { - "playwright-core": "=1.18.0" + "playwright-core": "=1.18.1" } }, "playwright-core": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.18.0.tgz", - "integrity": "sha512-JTRlCVpfAFcC1nth+XIE07w6M5m6C8PaEoClv7wGWF97cyDMcHIij0xIVEKMKli7IG5N0mqjLDFc/akXSbMZ1g==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.18.1.tgz", + "integrity": "sha512-NALGl8R1GHzGLlhUApmpmfh6M1rrrPcDTygWvhTbprxwGB9qd/j9DRwyn4HTQcUB6o0/VOpo46fH9ez3+D/Rog==", "dev": true, "requires": { "commander": "^8.2.0", @@ -15091,6 +15240,11 @@ "makeerror": "1.0.12" } }, + "web-streams-polyfill": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz", + "integrity": "sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==" + }, "webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", diff --git a/package.json b/package.json index 2dba7181d6..fbf0620def 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "iconv-lite": "^0.6.3", "module-alias": "^2.2.2", "moment": "^2.29.1", - "node-fetch": "^2.6.7", + "node-fetch-commonjs": "^3.1.1", "node-ical": "^0.13.0", "socket.io": "^4.4.1" }, diff --git a/tests/e2e/env_spec.js b/tests/e2e/env_spec.js index 1eb0fe1ec5..2845da47cd 100644 --- a/tests/e2e/env_spec.js +++ b/tests/e2e/env_spec.js @@ -1,4 +1,4 @@ -const fetch = require("node-fetch"); +const fetch = require("node-fetch-commonjs"); const helpers = require("./global-setup"); describe("App environment", function () { diff --git a/tests/e2e/fonts.js b/tests/e2e/fonts.js index 54cd2d87f2..784b987c4b 100644 --- a/tests/e2e/fonts.js +++ b/tests/e2e/fonts.js @@ -1,4 +1,4 @@ -const fetch = require("node-fetch"); +const fetch = require("node-fetch-commonjs"); const helpers = require("./global-setup"); describe("All font files from roboto.css should be downloadable", function () { diff --git a/tests/e2e/ipWhitelist_spec.js b/tests/e2e/ipWhitelist_spec.js index b518cfff9a..79d9c866a7 100644 --- a/tests/e2e/ipWhitelist_spec.js +++ b/tests/e2e/ipWhitelist_spec.js @@ -1,4 +1,4 @@ -const fetch = require("node-fetch"); +const fetch = require("node-fetch-commonjs"); const helpers = require("./global-setup"); describe("ipWhitelist directive configuration", function () { diff --git a/tests/e2e/port_config.js b/tests/e2e/port_config.js index 329acab619..390e0cbb3d 100644 --- a/tests/e2e/port_config.js +++ b/tests/e2e/port_config.js @@ -1,4 +1,4 @@ -const fetch = require("node-fetch"); +const fetch = require("node-fetch-commonjs"); const helpers = require("./global-setup"); describe("port directive configuration", function () { diff --git a/tests/e2e/vendor_spec.js b/tests/e2e/vendor_spec.js index f6917c0dc3..9c5424e6b0 100644 --- a/tests/e2e/vendor_spec.js +++ b/tests/e2e/vendor_spec.js @@ -1,4 +1,4 @@ -const fetch = require("node-fetch"); +const fetch = require("node-fetch-commonjs"); const helpers = require("./global-setup"); describe("Vendors", function () {