Skip to content

Commit

Permalink
refactor: node-fetch to undici
Browse files Browse the repository at this point in the history
Follow up to #143
  • Loading branch information
KhafraDev committed Jul 25, 2022
1 parent aad31ab commit 5a262b4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 22 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@sapphire/utilities": "^3.7.0",
"@types/jest": "^28.1.6",
"@types/node": "^18.0.6",
"@types/node-fetch": "^2.6.2",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"check-update": "cliff-jumper --dry-run"
},
"dependencies": {
"@types/node-fetch": "2.6.2",
"@types/psl": "^1.1.0",
"@types/ws": "^8.5.3",
"node-fetch": "2.6.7",
"psl": "^1.9.0",
"tslib": "^2.4.0"
"tslib": "^2.4.0",
"undici": "^4.7.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/lib/structures/http/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Routes,
RouteBases
} from 'discord-api-types/v9';
import fetch from 'node-fetch';
import { fetch } from 'undici';

export class Auth {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/routes/oauth/callback.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PieceContext } from '@sapphire/pieces';
import { OAuth2Routes, RESTPostOAuth2AccessTokenResult, RESTPostOAuth2AccessTokenURLEncodedData } from 'discord-api-types/v9';
import fetch from 'node-fetch';
import { fetch } from 'undici';
import { stringify } from 'querystring';
import type { ApiRequest } from '../../lib/structures/api/ApiRequest';
import type { ApiResponse } from '../../lib/structures/api/ApiResponse';
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/routes/oauth/logout.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OAuth2Routes } from 'discord-api-types/v9';
import fetch from 'node-fetch';
import { fetch } from 'undici';
import { stringify } from 'querystring';
import { promisify } from 'util';
import type { ApiRequest } from '../../lib/structures/api/ApiRequest';
Expand Down
45 changes: 29 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1094,12 +1094,12 @@ __metadata:
linkType: hard

"@npmcli/fs@npm:^1.0.0":
version: 1.1.1
resolution: "@npmcli/fs@npm:1.1.1"
version: 1.0.0
resolution: "@npmcli/fs@npm:1.0.0"
dependencies:
"@gar/promisify": ^1.0.1
semver: ^7.3.5
checksum: f5ad92f157ed222e4e31c352333d0901df02c7c04311e42a81d8eb555d4ec4276ea9c635011757de20cc476755af33e91622838de573b17e52e2e7703f0a9965
checksum: f2b4990107dd2a5b18794c89aaff6f62f3a67883d49a20602fdfc353cbc7f8c5fd50edeffdc769e454900e01b8b8e43d0b9eb524d00963d69f3c829be1a2e8ac
languageName: node
linkType: hard

Expand Down Expand Up @@ -1215,14 +1215,14 @@ __metadata:
resolution: "@sapphire/plugin-api@workspace:packages/api"
dependencies:
"@favware/cliff-jumper": ^1.8.5
"@types/node-fetch": 2.6.2
"@types/psl": ^1.1.0
"@types/ws": ^8.5.3
gen-esm-wrapper: ^1.1.3
node-fetch: 2.6.7
psl: ^1.9.0
tslib: ^2.4.0
typescript: ^4.7.4
undici: ^4.7.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -1591,7 +1591,7 @@ __metadata:
languageName: node
linkType: hard

"@types/node-fetch@npm:2.6.2, @types/node-fetch@npm:^2.6.2":
"@types/node-fetch@npm:^2.6.2":
version: 2.6.2
resolution: "@types/node-fetch@npm:2.6.2"
dependencies:
Expand All @@ -1601,7 +1601,14 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:*, @types/node@npm:>=12, @types/node@npm:^18.0.6":
"@types/node@npm:*":
version: 16.10.2
resolution: "@types/node@npm:16.10.2"
checksum: 83c1c3c68e7500103908c3f16094e458879c840a719c15b6ea577f81fe1f24a1b3473bb6c8e8091fe79a82543ca7639c6b1088fcf80292ec091d1d1c9504a87e
languageName: node
linkType: hard

"@types/node@npm:>=12, @types/node@npm:^18.0.6":
version: 18.0.6
resolution: "@types/node@npm:18.0.6"
checksum: 780f8885a6b6eb12f4c0246617747fdc37a451931b3c01ce8148d356c0903b705dcb16cc6a914de63d48b0dc1b002c7a3dfae681f580e1761aa551d3cd996813
Expand Down Expand Up @@ -2387,9 +2394,9 @@ __metadata:
linkType: hard

"camelcase@npm:^6.2.0":
version: 6.3.0
resolution: "camelcase@npm:6.3.0"
checksum: 8c96818a9076434998511251dcb2761a94817ea17dbdc37f47ac080bd088fc62c7369429a19e2178b993497132c8cbcf5cc1f44ba963e76782ba469c0474938d
version: 6.2.0
resolution: "camelcase@npm:6.2.0"
checksum: 8335cfd0ecc472eae685896a42afd8c9dacd193a91f569120b931c87deb053a1ba82102031b9b48a4dbc1d18066caeacf2e4ace8c3c7f0d02936d348dc0b5a87
languageName: node
linkType: hard

Expand Down Expand Up @@ -2632,9 +2639,9 @@ __metadata:
linkType: hard

"commander@npm:^8.2.0":
version: 8.3.0
resolution: "commander@npm:8.3.0"
checksum: 0f82321821fc27b83bd409510bb9deeebcfa799ff0bf5d102128b500b7af22872c0c92cb6a0ebc5a4cf19c6b550fba9cedfa7329d18c6442a625f851377bacf0
version: 8.2.0
resolution: "commander@npm:8.2.0"
checksum: e868805bc266777f7a9c8a740e15b9e02b8148d8251f577ea9b9ef373ac0bdeb77b9b60cfc033592c9e1affea89993be08c13c623f0c619f9bf152c0e4d12cb0
languageName: node
linkType: hard

Expand Down Expand Up @@ -4239,14 +4246,14 @@ __metadata:
linkType: hard

"import-local@npm:^3.0.2":
version: 3.1.0
resolution: "import-local@npm:3.1.0"
version: 3.0.3
resolution: "import-local@npm:3.0.3"
dependencies:
pkg-dir: ^4.2.0
resolve-cwd: ^3.0.0
bin:
import-local-fixture: fixtures/cli.js
checksum: bfcdb63b5e3c0e245e347f3107564035b128a414c4da1172a20dc67db2504e05ede4ac2eee1252359f78b0bfd7b19ef180aec427c2fce6493ae782d73a04cddd
checksum: 38ae57d35e7fd5f63b55895050c798d4dd590e4e2337e9ffa882fb3ea7a7716f3162c7300e382e0a733ca5d07b389fadff652c00fa7b072d5cb6ea34ca06b179
languageName: node
linkType: hard

Expand Down Expand Up @@ -6737,7 +6744,6 @@ __metadata:
"@sapphire/utilities": ^3.7.0
"@types/jest": ^28.1.6
"@types/node": ^18.0.6
"@types/node-fetch": ^2.6.2
"@types/ws": ^8.5.3
"@typescript-eslint/eslint-plugin": ^5.30.7
"@typescript-eslint/parser": ^5.30.7
Expand Down Expand Up @@ -7766,6 +7772,13 @@ __metadata:
languageName: node
linkType: hard

"undici@npm:^4.7.0":
version: 4.7.0
resolution: "undici@npm:4.7.0"
checksum: bfa38ba56f2d90c1c6b9eb2e5cfd8e183c79062c81edf1aa35f24f504bcd474c4c117b48ba97f2e510c1627f48ca2f2eb3bf712e2da1bce6ec2bf87b223e9625
languageName: node
linkType: hard

"unique-filename@npm:^1.1.1":
version: 1.1.1
resolution: "unique-filename@npm:1.1.1"
Expand Down

0 comments on commit 5a262b4

Please sign in to comment.