import { PackageJson } from '@pnpm/types';
import { LoggedPkg } from '../loggers';
import { Got } from '../network/got';
import { PackageMeta } from './npm';
export { PackageMeta };
/**
 * tarball hosted remotely
 */
export interface TarballResolution {
    type?: undefined;
    tarball: string;
    integrity?: string;
    registry?: string;
}
/**
 * directory on a file system
 */
export interface DirectoryResolution {
    type: 'directory';
    directory: string;
}
/**
 * Git repository
 */
export interface GitRepositoryResolution {
    type: 'git';
    repo: string;
    commit: string;
}
export declare type Resolution = TarballResolution | GitRepositoryResolution | DirectoryResolution;
export interface ResolveResult {
    id: string;
    resolution: Resolution;
    package?: PackageJson;
    latest?: string;
}
export declare type HostedPackageSpec = PackageSpecBase & {
    type: 'git';
    registry: false;
    gitCommittish: string;
    hosted?: {
        type: string;
        shortcut: string;
        sshUrl: string;
        user: string;
        project: string;
        committish: string;
    };
};
export declare type RegistryPackageSpec = PackageSpecBase & {
    type: 'tag' | 'version' | 'range';
    registry: true;
};
export interface PackageSpecBase {
    raw: string;
    rawSpec: string;
    name: string;
    scope: string;
    saveSpec: string;
    fetchSpec: string;
    dev: boolean;
    optional: boolean;
}
export declare type PackageSpec = HostedPackageSpec | RegistryPackageSpec | PackageSpecBase & {
    type: 'directory' | 'file' | 'remote';
    registry: false;
};
export interface ResolveOptions {
    loggedPkg: LoggedPkg;
    got: Got;
    storePath: string;
    registry: string;
    metaCache: Map<string, PackageMeta>;
    prefix: string;
    offline: boolean;
    downloadPriority: number;
}
/**
 * Resolves a package in the NPM registry. Done as part of `install()`.
 *
 * @example
 *     var npa = require('npm-package-arg')
 *     resolve(npa('rimraf@2'))
 *       .then((res) => {
 *         res.id == 'rimraf@2.5.1'
 *         res.dist == {
 *           shasum: '0a1b2c...'
 *           tarball: 'http://...'
 *         }
 *       })
 */
export default function (spec: PackageSpec, opts: ResolveOptions): Promise<ResolveResult>;
