diff --git a/package-lock.json b/package-lock.json index cad136a6c..2a2391b06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -73,7 +73,6 @@ "medidoc": "1.1.0", "mem": "^8.1.1", "meteor-node-stubs": "^1.2.5", - "node-fetch": "^3.3.2", "notistack": "^3.0.1", "papaparse": "^5.4.1", "pdfjs-dist": "~3.4.120", @@ -12684,14 +12683,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "engines": { - "node": ">= 12" - } - }, "node_modules/data-view-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", @@ -15063,28 +15054,6 @@ "pend": "~1.2.0" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "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/fflate": { "version": "0.4.8", "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", @@ -15404,17 +15373,6 @@ "node": ">= 14.17" } }, - "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/formidable": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", @@ -21590,41 +21548,6 @@ "node": ">= 0.10.5" } }, - "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": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", diff --git a/package.json b/package.json index 2cd245e91..3d1bab640 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,6 @@ "medidoc": "1.1.0", "mem": "^8.1.1", "meteor-node-stubs": "^1.2.5", - "node-fetch": "^3.3.2", "notistack": "^3.0.1", "papaparse": "^5.4.1", "pdfjs-dist": "~3.4.120", diff --git a/server/polyfill.ts b/server/polyfill.ts index 0125dead4..7678d9eca 100644 --- a/server/polyfill.ts +++ b/server/polyfill.ts @@ -3,6 +3,3 @@ import 'regenerator-runtime/runtime.js'; // eslint-disable-next-line import/no-unassigned-import import 'core-js/features/string/replace-all'; - -// eslint-disable-next-line import/no-unassigned-import -import './polyfill/fetch'; diff --git a/server/polyfill/fetch.ts b/server/polyfill/fetch.ts deleted file mode 100644 index 6dc26f591..000000000 --- a/server/polyfill/fetch.ts +++ /dev/null @@ -1,25 +0,0 @@ -// SEE -// https://github.com/node-fetch/node-fetch/blob/8b3320d2a7c07bce4afc6b2bf6c3bbddda85b01f/README.md#providing-global-access - -import process from 'process'; - -import fetch, {Blob, Headers, Request, Response} from 'node-fetch'; - -import semver from 'semver'; - -if (semver.gte(process.version, '18.0.0')) { - // eslint-disable-next-line unicorn/prefer-module - throw new Error(`Remove node-fetch polyfill located at '${__filename}'.`); -} - -if (Meteor.isServer && !globalThis.fetch) { - // @ts-expect-error fetch polyfill has incorrect type. - globalThis.fetch = fetch; - globalThis.Blob = Blob; - // @ts-expect-error Headers polyfill has incorrect type. - globalThis.Headers = Headers; - // @ts-expect-error Request polyfill has incorrect type. - globalThis.Request = Request; - // @ts-expect-error Response polyfill has incorrect type. - globalThis.Response = Response; -}