Vigia

Aktualizacja node-fetch z 2.x do 3.x

Porównanie publicznego API node-fetch 2.7.0 i 3.3.2, obliczone automatycznie na podstawie typów TypeScript. Zmieniona sygnatura to możliwa zmiana niekompatybilna, a nie pewność.

Podsumowanie

Usunięte ścieżki importu1
Usunięte eksporty6
Zmienione sygnatury5
Usunięte składowe klas lub interfejsów19
Zmienione składowe klas lub interfejsów14
Nowo wycofane3
Zmiany wymagań (engines, zależności peer)2
Nowe eksporty7

Usunięte ścieżki importu

Usunięte ścieżki importu
node-fetch/externals

Usunięte eksporty

importexportkindPrzed
node-fetchHeaderInittypeHeaders | string[][] | { [key: string]: string | string[]; }
node-fetchRequestModetype"same-origin" | "cors" | "no-cors"
node-fetchRequestCachetype"default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"
node-fetchResponseTypetype"error" | "default" | "cors" | "basic" | "opaque" | "opaqueredirect"
node-fetchRequestContexttype"object" | "audio" | "beacon" | "cspreport" | "download" | "embed" | "eventsource" | "favicon" | "fetch" | "font" | "form" | "frame" | "hyperlink" | "iframe" | "image" | "imageset" | "import" | "internal" | "location" | "manifest" | "ping" | "plugin" | "prefetch" | "script" | "serviceworker" | "sharedworker" | "style" | "subresource" | "track" | "video" | "worker" | "xmlhttprequest" | "xslt"
node-fetchRequestCredentialstype"omit" | "include" | "same-origin"

Zmienione sygnatury

exportPrzedPo
node-fetch · Blobclassany
node-fetch · Bodyclassinterface
node-fetch · default(url: RequestInfo, init?: RequestInit | undefined): Promise<Response>(url: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response>
node-fetch · HeadersInitHeaders | string[][] | { [key: string]: string | string[]; }Headers | Record<string, string> | Iterable<readonly [string, string]> | Iterable<Iterable<string>>
node-fetch · RequestInfostring | Request | URLLikestring | Request

Usunięte składowe klas lub interfejsów

memberimportPrzed
Body.timeoutnode-fetchnumber
Body.textConvertednode-fetch(): Promise<string>
Request.portnode-fetchnumber | undefined
Request.agentnode-fetchany
Request.follownode-fetchnumber
Request.contextnode-fetchRequestContext
Request.counternode-fetchnumber
Request.timeoutnode-fetchnumber
Request.compressnode-fetchboolean
Request.hostnamenode-fetchstring
Request.protocolnode-fetchstring
Request.textConvertednode-fetch(): Promise<string>
Response.timeoutnode-fetchnumber
Response.textConvertednode-fetch(): Promise<string>
RequestInit.timeoutnode-fetchnumber | undefined
ResponseInit.urlnode-fetchstring | undefined
ResponseInit.sizenode-fetchnumber | undefined
ResponseInit.counternode-fetchnumber | undefined
ResponseInit.timeoutnode-fetchnumber | undefined

Zmienione składowe klas lub interfejsów

memberPrzedPo
Body.bodyNodeJS.ReadableStreamany
Body.json(): Promise<any>(): Promise<unknown>
Body.constructor(body?: any, opts?: { size?: number | undefined; timeout?: number | undefined; } | undefined): Body
Headers.raw(): { [k: string]: string[]; }(): Record<string, string[]>
Headers.forEach(callback: (value: string, name: string) => void): void(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void
Request.bodyNodeJS.ReadableStreamany
Request.json(): Promise<any>(): Promise<unknown>
Request.constructor(input: RequestInfo, init?: RequestInit | undefined): Request(input: URL | RequestInfo, init?: RequestInit | undefined): Request
Response.bodyNodeJS.ReadableStreamany
Response.json(): Promise<any>(): Promise<unknown>
Response.static redirect(url: string, status: number): Response(url: string, status?: number | undefined): Response
AbortError.type"aborted"string
AbortError.constructor(message: string): AbortError(message?: string | undefined): AbortError | (message?: string | undefined, options?: ErrorOptions | undefined): AbortError
FetchError.constructor(message: string, type: string, systemError?: SystemError | undefined): FetchError(message: string, type: string, systemError?: Record<string, unknown> | undefined): FetchError

Nowo wycofane

export@deprecated
node-fetch · Body.bufferUse `body.arrayBuffer()` instead.
node-fetch · Request.bufferUse `body.arrayBuffer()` instead.
node-fetch · Response.bufferUse `body.arrayBuffer()` instead.

Zmiany wymagań (engines, zależności peer)

PrzedPo
engines.node4.x || >=6.0.0^12.20.0 || ^14.13.1 || >=16.0.0
peerDependencies.encoding^0.1.0—
Nowe eksporty (7)
importexportkind
node-fetchFilevariable
node-fetchFormDatavariable
node-fetchblobFromvariable
node-fetchfileFromvariable
node-fetchblobFromSyncvariable
node-fetchfileFromSyncvariable
node-fetchReferrerPolicytype

Najczęściej zadawane pytania

Jakie są zmiany niekompatybilne przy aktualizacji node-fetch z 2 do 3?

Między node-fetch 2.7.0 a 3.3.2 Vigia znalazła 6 usuniętych eksportów, 5 zmienionych sygnatur i 33 usuniętych lub zmienionych składowych klas lub interfejsów.

Co zostało wycofane w node-fetch 3?

3 eksportów lub składowych oznaczono w node-fetch 3.3.2 jako wycofane.

Dla agentów

GET https://vigia.coredls.cloud/v1/packages/npm/node-fetch/upgrade?from=2.7.0&to=3.3.2