Оновлення node-fetch з 2.x до 3.x
Порівняння публічного API node-fetch 2.7.0 і 3.3.2, обчислене автоматично за їхніми типами TypeScript. Змінена сигнатура — можлива несумісна зміна, а не гарантія.
Підсумок
| Видалені шляхи імпорту | 1 |
|---|---|
| Видалені експорти | 6 |
| Змінені сигнатури | 5 |
| Видалені члени класів або інтерфейсів | 19 |
| Змінені члени класів або інтерфейсів | 14 |
| Нові застарівання | 3 |
| Зміни вимог (engines, peer-залежності) | 2 |
| Нові експорти | 7 |
Видалені шляхи імпорту
| Видалені шляхи імпорту |
|---|
node-fetch/externals |
Видалені експорти
| import | export | kind | Було |
|---|---|---|---|
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" |
Змінені сигнатури
| export | Було | Стало |
|---|---|---|
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 |
Видалені члени класів або інтерфейсів
| member | import | Було |
|---|---|---|
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 |
Змінені члени класів або інтерфейсів
| member | Було | Стало |
|---|---|---|
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 |
Нові застарівання
| 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. |
Зміни вимог (engines, peer-залежності)
| Було | Стало | |
|---|---|---|
engines.node | 4.x || >=6.0.0 | ^12.20.0 || ^14.13.1 || >=16.0.0 |
peerDependencies.encoding | ^0.1.0 | — |
Нові експорти (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 |
Поширені запитання
Які несумісні зміни під час оновлення node-fetch з 2 до 3?
Між node-fetch 2.7.0 і 3.3.2 Vigia знайшла видалених експортів: 6, змінених сигнатур: 5, видалених або змінених членів класів та інтерфейсів: 33.
Що застаріло в node-fetch 3?
У node-fetch 3.3.2 новими застарілими позначено експортів або членів: 3.
Для агентів
GET https://vigia.coredls.cloud/v1/packages/npm/node-fetch/upgrade?from=2.7.0&to=3.3.2