pnpm
Version:
A fast implementation of npm install
38 lines (37 loc) • 995 B
TypeScript
import { PackageSpec } from '../install';
import { Got } from '../network/got';
import { FetchOptions } from './fetch';
export declare type ResolveResult = {
id: string;
fetch(target: string, opts: FetchOptions): Promise<void>;
root?: string;
};
export declare type HostedPackageSpec = PackageSpec & {
hosted: {
type: string;
shortcut: string;
sshUrl: string;
};
};
export declare type ResolveOptions = {
log(msg: string): void;
got: Got;
root: string;
linkLocal: boolean;
tag: string;
};
/**
* 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>;