export declare class PnpmError extends Error { readonly code: string; readonly hint?: string; attempts?: number; prefix?: string; pkgsStack?: Array<{ id: string; name: string; version: string; }>; constructor(code: string, message: string, opts?: { attempts?: number; hint?: string; cause?: unknown; }); } export interface FetchErrorResponse { status: number; statusText: string; } export interface FetchErrorRequest { url: string; authHeaderValue?: string; } export declare class FetchError extends PnpmError { readonly response: FetchErrorResponse; readonly request: FetchErrorRequest; constructor(request: FetchErrorRequest, response: FetchErrorResponse, hint?: string); } /** * undici fails a timed-out request with a bare `fetch failed` or `terminated` * and keeps the timeout only in the error's `cause` chain. */ export declare function isFetchTimeoutError(error: unknown): boolean; export declare class FetchTimeoutError extends PnpmError { constructor(code: string, url: string, timeout: number | undefined, opts: { attempts?: number; cause: unknown; }); } /** * Strip `user:pass@` (or `user@`) userinfo that follows a URL scheme in any * text, e.g. `GET https://user:pass@host/pkg: ...` → `GET https://host/pkg: ...`. * A registry configured as `https://user:pass@host/` would otherwise leak its * embedded basic-auth credentials into every error message that interpolates * the request URL (terminal output, CI logs). `FetchError` already hides the * auth *header*; this covers credentials carried in the URL itself. * * Implemented as a single forward scan rather than a regex: `text` is * uncontrolled (it interpolates the request URL), so a backtracking pattern is * a ReDoS vector, and the scan strips up to the **last** `@` in the authority * so a raw `@` inside the password (`user:p@ss@host`) doesn't leak its tail. */ export declare function redactUrlCredentials(text: string): string; /** * Make untrusted, URL-bearing text safe to print or log: redact inline * `user:pass@` credentials ({@link redactUrlCredentials}) and strip every * control character. Both can appear in error messages that echo an * untrusted URL or subprocess stderr back, which must not leak credentials * or inject terminal output via raw escapes / `\r` / `\n`. */ export declare function redactAndSanitize(text: string): string; /** * Make a URL safe for user-visible output without exposing credentials, * query parameters, fragments, or terminal control characters. Malformed * URLs are replaced entirely because their authority cannot be redacted * reliably. */ export declare function redactUrlForDisplay(url: string): string; /** * {@link redactAndSanitize} for text whose line breaks are worth keeping, such * as a subprocess's multi-line stderr. * * Line breaks are kept only when doing so redacts exactly as much as * collapsing the text would: a newline can fall inside a `user:pass@` * authority (git echoes such a URL back verbatim, password included), and * redacting each line separately would leave the credentials split but * readable. Whenever the two disagree, the collapsed form wins. */ export declare function redactAndSanitizeMultiline(text: string): string; export declare class LockfileMissingDependencyError extends PnpmError { constructor(depPath: string); } /** * Whether `value` is an `Error`, whichever way the runtime created it. * * `util.types.isNativeError` misses the errors that StackBlitz WebContainers * reject asynchronous `fs` calls with: they inherit from `Error`, but the * native constructor did not create them. `instanceof Error` misses errors * from another realm, such as the ones code under Jest's VM contexts catches. * Either check passing is enough. */ export declare function isError(value: unknown): value is Error;