import { type Graph, type Integrity } from './graph.js'; export type Awaitable = T | Promise; export type Limiter = (task: () => Promise) => Promise; export type Fetch = typeof globalThis.fetch; export interface PackumentVersion { readonly name: string; readonly version: string; readonly integrity?: Integrity; readonly tarball?: string; readonly dependencies?: Readonly>; readonly devDependencies?: Readonly>; readonly optionalDependencies?: Readonly>; readonly peerDependencies?: Readonly>; readonly peerDependenciesMeta?: Readonly>>; readonly engines?: Readonly>; readonly funding?: unknown; readonly os?: readonly string[]; readonly cpu?: readonly string[]; readonly libc?: readonly string[]; readonly deprecated?: string; readonly bin?: string | Readonly>; readonly bundledDependencies?: readonly string[]; readonly hasInstallScript?: boolean; readonly license?: string; readonly type?: string; readonly main?: string; readonly exports?: unknown; } export interface Packument { readonly name: string; readonly distTags: Readonly>; readonly versions: Readonly>; } export interface RegistryAdapter { packument(name: string): Promise; resolve(name: string, range: string): Promise; manifest?(name: string, version: string): Promise; readonly limit?: Limiter; } export interface ArtifactRoute { readonly registryUrl: string; readonly fetch: Fetch; readonly authHeaderFor: (url: string) => string | undefined; readonly limit: Limiter; } export interface RemoteArtifactRegistry extends RegistryAdapter { artifactRoute(name: string): ArtifactRoute | undefined; } export type RegistryConfigDialect = 'npm' | 'pnpm' | 'yarn-classic' | 'yarn-berry'; /** @deprecated Use RegistryConfigDialect. The type is unchanged. */ export type Ecosystem = RegistryConfigDialect; export interface RegistryConfig { registryFor(packageName: string): string; authHeaderFor(registryUrl: string): string | undefined; } export interface ResolveRegistryOptions { readonly config: RegistryConfigDialect; readonly registry?: string; readonly env?: Readonly>; readonly home?: string; } export interface LiveRegistryDirectOptions { readonly url?: string; readonly authHeader?: string; readonly cwd?: never; readonly config?: never; readonly registry?: never; readonly env?: never; readonly home?: never; readonly fetch?: Fetch; readonly limit?: Limiter; } export interface LiveRegistryDiscoveryOptions extends ResolveRegistryOptions { readonly cwd: string; readonly url?: never; readonly authHeader?: never; readonly fetch?: Fetch; readonly limit?: Limiter; } export interface LiveRegistryConfigOptions { readonly config: RegistryConfig; readonly cwd?: never; readonly registry?: never; readonly env?: never; readonly home?: never; readonly url?: never; readonly authHeader?: never; readonly fetch?: Fetch; readonly limit?: Limiter; } export type LiveRegistryOptions = LiveRegistryDiscoveryOptions | LiveRegistryConfigOptions | LiveRegistryDirectOptions; export type RawAdvisory = Readonly>; export interface AuditOptions { readonly chunkSize?: number; } export interface LiveRegistryAdapter extends RemoteArtifactRegistry { audit(packages: Readonly>, options?: AuditOptions): Promise>>; } export declare const resolveRegistry: (cwd: string, options: ResolveRegistryOptions) => RegistryConfig; export declare const liveRegistry: (options?: LiveRegistryOptions) => LiveRegistryAdapter; export declare function frozenRegistry(graph: Graph): RegistryAdapter; export declare const defaultFetch: Fetch;