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 importu | 1 |
|---|---|
| Usunięte eksporty | 6 |
| Zmienione sygnatury | 5 |
| Usunięte składowe klas lub interfejsów | 19 |
| Zmienione składowe klas lub interfejsów | 14 |
| Nowo wycofane | 3 |
| Zmiany wymagań (engines, zależności peer) | 2 |
| Nowe eksporty | 7 |
Usunięte ścieżki importu
| Usunięte ścieżki importu |
|---|
node-fetch/externals |
Usunięte eksporty
| import | export | kind | Przed |
|---|---|---|---|
node-fetch | HeaderInit | type | Headers | string[][] | { [key: string]: string | string[]; } |
node-fetch | RequestMode | type | "same-origin" | "cors" | "no-cors" |
node-fetch | RequestCache | type | "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" |
node-fetch | ResponseType | type | "error" | "default" | "cors" | "basic" | "opaque" | "opaqueredirect" |
node-fetch | RequestContext | type | "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-fetch | RequestCredentials | type | "omit" | "include" | "same-origin" |
Zmienione sygnatury
| export | Przed | Po |
|---|---|---|
node-fetch · Blob | class | any |
node-fetch · Body | class | interface |
node-fetch · default | (url: RequestInfo, init?: RequestInit | undefined): Promise<Response> | (url: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response> |
node-fetch · HeadersInit | Headers | string[][] | { [key: string]: string | string[]; } | Headers | Record<string, string> | Iterable<readonly [string, string]> | Iterable<Iterable<string>> |
node-fetch · RequestInfo | string | Request | URLLike | string | Request |
Usunięte składowe klas lub interfejsów
| member | import | Przed |
|---|---|---|
Body.timeout | node-fetch | number |
Body.textConverted | node-fetch | (): Promise<string> |
Request.port | node-fetch | number | undefined |
Request.agent | node-fetch | any |
Request.follow | node-fetch | number |
Request.context | node-fetch | RequestContext |
Request.counter | node-fetch | number |
Request.timeout | node-fetch | number |
Request.compress | node-fetch | boolean |
Request.hostname | node-fetch | string |
Request.protocol | node-fetch | string |
Request.textConverted | node-fetch | (): Promise<string> |
Response.timeout | node-fetch | number |
Response.textConverted | node-fetch | (): Promise<string> |
RequestInit.timeout | node-fetch | number | undefined |
ResponseInit.url | node-fetch | string | undefined |
ResponseInit.size | node-fetch | number | undefined |
ResponseInit.counter | node-fetch | number | undefined |
ResponseInit.timeout | node-fetch | number | undefined |
Zmienione składowe klas lub interfejsów
| member | Przed | Po |
|---|---|---|
Body.body | NodeJS.ReadableStream | any |
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.body | NodeJS.ReadableStream | any |
Request.json | (): Promise<any> | (): Promise<unknown> |
Request.constructor | (input: RequestInfo, init?: RequestInit | undefined): Request | (input: URL | RequestInfo, init?: RequestInit | undefined): Request |
Response.body | NodeJS.ReadableStream | any |
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.buffer | Use `body.arrayBuffer()` instead. |
node-fetch · Request.buffer | Use `body.arrayBuffer()` instead. |
node-fetch · Response.buffer | Use `body.arrayBuffer()` instead. |
Zmiany wymagań (engines, zależności peer)
| Przed | Po | |
|---|---|---|
engines.node | 4.x || >=6.0.0 | ^12.20.0 || ^14.13.1 || >=16.0.0 |
peerDependencies.encoding | ^0.1.0 | — |
Nowe eksporty (7)
| import | export | kind |
|---|---|---|
node-fetch | File | variable |
node-fetch | FormData | variable |
node-fetch | blobFrom | variable |
node-fetch | fileFrom | variable |
node-fetch | blobFromSync | variable |
node-fetch | fileFromSync | variable |
node-fetch | ReferrerPolicy | type |
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