mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-15 03:56:15 -04:00
Replace node-fetch with native undici for HTTP requests throughout pnpm. Key changes: - Replace node-fetch with undici's fetch() and dispatcher system - Replace @pnpm/network.agent with a new dispatcher module in @pnpm/network.fetch - Cache dispatchers via LRU cache keyed by connection parameters - Handle proxies via undici ProxyAgent instead of http/https-proxy-agent - Convert test mocking from nock to undici MockAgent where applicable - Add minimatch@9 override to fix ESM incompatibility with brace-expansion
34 lines
706 B
TypeScript
34 lines
706 B
TypeScript
import {
|
|
type LogBase,
|
|
logger,
|
|
} from '@pnpm/logger'
|
|
|
|
export const requestRetryLogger = logger<RequestRetryMessage>('request-retry')
|
|
|
|
export interface RequestRetryError {
|
|
name?: string
|
|
message?: string
|
|
// HTTP status codes (numeric)
|
|
status?: number
|
|
statusCode?: number
|
|
// System error properties
|
|
errno?: number
|
|
code?: string
|
|
// undici wraps the actual error in a cause property
|
|
cause?: {
|
|
code?: string
|
|
errno?: number
|
|
}
|
|
}
|
|
|
|
export interface RequestRetryMessage {
|
|
attempt: number
|
|
error: RequestRetryError
|
|
maxRetries: number
|
|
method: string
|
|
timeout: number
|
|
url: string
|
|
}
|
|
|
|
export type RequestRetryLog = { name: 'pnpm:request-retry' } & LogBase & RequestRetryMessage
|