Actualizar node-fetch de 2.x a 3.x
Comparación de la API pública de node-fetch 2.7.0 y 3.3.2, calculada automáticamente a partir de sus tipos TypeScript. Una firma modificada es un posible cambio incompatible, no una certeza.
Resumen
| Rutas de importación eliminadas | 1 |
|---|---|
| Exports eliminados | 6 |
| Firmas modificadas | 5 |
| Miembros de clases o interfaces eliminados | 19 |
| Miembros de clases o interfaces modificados | 14 |
| Nuevas deprecaciones | 3 |
| Cambios de requisitos (engines, dependencias peer) | 2 |
| Exports nuevos | 7 |
Rutas de importación eliminadas
| Rutas de importación eliminadas |
|---|
node-fetch/externals |
Exports eliminados
| import | export | kind | Antes |
|---|---|---|---|
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" |
Firmas modificadas
| export | Antes | Después |
|---|---|---|
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 |
Miembros de clases o interfaces eliminados
| member | import | Antes |
|---|---|---|
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 |
Miembros de clases o interfaces modificados
| member | Antes | Después |
|---|---|---|
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 |
Nuevas deprecaciones
| 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. |
Cambios de requisitos (engines, dependencias peer)
| Antes | Después | |
|---|---|---|
engines.node | 4.x || >=6.0.0 | ^12.20.0 || ^14.13.1 || >=16.0.0 |
peerDependencies.encoding | ^0.1.0 | — |
Exports nuevos (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 |
Preguntas frecuentes
¿Cuáles son los cambios incompatibles al actualizar node-fetch de 2 a 3?
Entre node-fetch 2.7.0 y 3.3.2, Vigia encontró 6 exports eliminados, 5 firmas modificadas y 33 miembros de clases o interfaces eliminados o modificados.
¿Qué quedó deprecado en node-fetch 3?
3 exports o miembros quedaron marcados como deprecados en node-fetch 3.3.2.
Para agentes
GET https://vigia.coredls.cloud/v1/packages/npm/node-fetch/upgrade?from=2.7.0&to=3.3.2