Skip to content

Commit f8c114a

Browse files
authored
[client] Remove @zeit/fetch and always use node-fetch instead (#12171)
[`@zeit/fetch` is archived](https://github.com/vercel/fetch) and it causes deprecation warnings for `util._extend` usage.
1 parent 5e5a601 commit f8c114a

File tree

6 files changed

+19
-89
lines changed

6 files changed

+19
-89
lines changed

.changeset/red-toys-raise.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vercel/client': patch
3+
---
4+
5+
Replace `@zeit/fetch` usage with `node-fetch`

packages/client/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"@vercel/build-utils": "8.4.5",
4141
"@vercel/error-utils": "2.0.2",
4242
"@vercel/routing-utils": "3.1.0",
43-
"@zeit/fetch": "5.2.0",
4443
"async-retry": "1.2.3",
4544
"async-sema": "3.0.0",
4645
"fs-extra": "8.0.1",

packages/client/src/upload.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ export async function* upload(
145145
apiUrl,
146146
userAgent,
147147
},
148-
clientOptions.debug,
149-
true
148+
clientOptions.debug
150149
);
151150

152151
if (res.status === 200) {

packages/client/src/utils/fetch.ts

-6
This file was deleted.

packages/client/src/utils/index.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { FilesMap } from './hashes';
2-
import { FetchOptions } from '@zeit/fetch';
3-
import { nodeFetch, zeitFetch } from './fetch';
2+
import nodeFetch, { RequestInit } from 'node-fetch';
43
import { join, sep, relative, basename } from 'path';
54
import { URL } from 'url';
65
import ignore from 'ignore';
@@ -231,7 +230,7 @@ function clearRelative(str: string) {
231230
return str.replace(/(\n|^)\.\//g, '$1');
232231
}
233232

234-
interface FetchOpts extends FetchOptions {
233+
interface FetchOpts extends RequestInit {
235234
apiUrl?: string;
236235
method?: string;
237236
teamId?: string;
@@ -243,8 +242,7 @@ export const fetch = async (
243242
url: string,
244243
token: string,
245244
opts: FetchOpts = {},
246-
debugEnabled?: boolean,
247-
useNodeFetch?: boolean
245+
debugEnabled?: boolean
248246
): Promise<any> => {
249247
semaphore.acquire();
250248
const debug = createDebug(debugEnabled);
@@ -278,9 +276,7 @@ export const fetch = async (
278276

279277
debug(`${opts.method || 'GET'} ${url}`);
280278
time = Date.now();
281-
const res = useNodeFetch
282-
? await nodeFetch(url, opts)
283-
: await zeitFetch(url, opts);
279+
const res = await nodeFetch(url, opts);
284280
debug(`DONE in ${Date.now() - time}ms: ${opts.method || 'GET'} ${url}`);
285281
semaphore.release();
286282

pnpm-lock.yaml

+9-72
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)