import { URL } from 'node:url'; import type { FetchFromRegistry } from '@pnpm/fetching.types'; import type { RegistryConfig } from '@pnpm/types'; import { type DispatcherOptions } from './dispatcher.js'; import { type RequestInit } from './fetch.js'; export interface FetchWithDispatcherOptions extends RequestInit { dispatcherOptions: DispatcherOptions; } export declare function fetchWithDispatcher(url: string | URL, opts: FetchWithDispatcherOptions): Promise; export interface CreateDispatchedFetchOptions extends DispatcherOptions { /** * Per-registry config (TLS, auth, etc.). When set, the matching TLS entries * are automatically extracted into `clientCertificates` so callers don't * have to do it themselves. */ configByUri?: Record; } /** * Returns a {@link fetch} pre-bound to the given dispatcher options, so callers * that need a fetch function (rather than a one-shot call) can route their * requests through the configured proxy / TLS / local-address settings. */ export declare function createDispatchedFetch(opts: CreateDispatchedFetchOptions): (url: string | URL, opts?: RequestInit) => Promise; export type { DispatcherOptions }; export interface CreateFetchFromRegistryOptions extends DispatcherOptions { userAgent?: string; configByUri?: Record; } export declare function createFetchFromRegistry(defaultOpts: CreateFetchFromRegistryOptions): FetchFromRegistry;