|
-
- import {Agent as HttpAgent} from 'http';
- import {Agent as HttpsAgent} from 'https';
-
- declare class VersionNotFoundErrorClass extends Error {
- readonly name: 'VersionNotFoundError';
-
- constructor(packageName: string, version: string);
- }
-
- declare class PackageNotFoundErrorClass extends Error {
- readonly name: 'PackageNotFoundError';
-
- constructor(packageName: string);
- }
-
- declare namespace packageJson {
- interface Agents {
- http?: HttpAgent;
- https?: HttpsAgent;
- }
-
- interface Options {
-
-
- readonly version?: string;
-
-
-
- readonly fullMetadata?: boolean;
-
-
-
- readonly allVersions?: boolean;
-
-
-
- readonly registryUrl?: string;
-
-
-
- readonly agent?: HttpAgent | HttpsAgent | Agents | false;
- }
-
- interface FullMetadataOptions extends Options {
-
-
- readonly fullMetadata: true;
- }
-
- interface DistTags {
- readonly latest: string;
- readonly [tagName: string]: string;
- }
-
- interface AbbreviatedMetadata {
- readonly 'dist-tags': DistTags;
- readonly modified: string;
- readonly name: string;
- readonly versions: {readonly [version: string]: AbbreviatedVersion};
- readonly [key: string]: unknown;
- }
-
- interface AbbreviatedVersion {
- readonly name: string;
- readonly version: string;
- readonly dist: {
- readonly shasum: string;
- readonly tarball: string;
- readonly integrity?: string;
- };
- readonly deprecated?: string;
- readonly dependencies?: {readonly [name: string]: string};
- readonly optionalDependencies?: {readonly [name: string]: string};
- readonly devDependencies?: {readonly [name: string]: string};
- readonly bundleDependencies?: {readonly [name: string]: string};
- readonly peerDependencies?: {readonly [name: string]: string};
- readonly bin?: {readonly [key: string]: string};
- readonly directories?: readonly string[];
- readonly engines?: {readonly [type: string]: string};
- readonly _hasShrinkwrap?: boolean;
- readonly [key: string]: unknown;
- }
-
- interface Person {
- readonly name?: string;
- readonly email?: string;
- readonly url?: string;
- }
-
- interface HoistedData {
- readonly author?: Person;
- readonly bugs?:
- | {readonly url: string; readonly email?: string}
- | {readonly url?: string; readonly email: string};
- readonly contributors?: readonly Person[];
- readonly description?: string;
- readonly homepage?: string;
- readonly keywords?: readonly string[];
- readonly license?: string;
- readonly maintainers?: readonly Person[];
- readonly readme?: string;
- readonly readmeFilename?: string;
- readonly repository?: {readonly type: string; readonly url: string};
- }
-
- interface FullMetadata extends AbbreviatedMetadata, HoistedData {
- readonly _id: string;
- readonly _rev: string;
- readonly time: {
- readonly created: string;
- readonly modified: string;
- readonly [version: string]: string;
- };
- readonly users?: {readonly [user: string]: boolean};
- readonly versions: {readonly [version: string]: FullVersion};
- readonly [key: string]: unknown;
- }
-
- interface FullVersion extends AbbreviatedVersion, HoistedData {
- readonly _id: string;
- readonly _nodeVersion: string;
- readonly _npmUser: string;
- readonly _npmVersion: string;
- readonly main?: string;
- readonly files?: readonly string[];
- readonly man?: readonly string[];
- readonly scripts?: {readonly [scriptName: string]: string};
- readonly gitHead?: string;
- readonly types?: string;
- readonly typings?: string;
- readonly [key: string]: unknown;
- }
-
- type VersionNotFoundError = VersionNotFoundErrorClass;
- type PackageNotFoundError = PackageNotFoundErrorClass;
- }
-
- declare const packageJson: {
-
-
- (packageName: string, options: packageJson.FullMetadataOptions): Promise<
- packageJson.FullMetadata
- >;
- (packageName: string, options?: packageJson.Options): Promise<
- packageJson.AbbreviatedMetadata
- >;
-
-
-
- VersionNotFoundError: typeof VersionNotFoundErrorClass;
-
-
-
- PackageNotFoundError: typeof PackageNotFoundErrorClass;
-
-
- default: typeof packageJson;
- };
-
- export = packageJson;
|