UNPKG

3.44 kBTypeScriptView Raw
1import { FakeFS, Filename, PortablePath } from '@yarnpkg/fslib';
2import { Resolution } from '@yarnpkg/parsers';
3import { IdentHash } from './types';
4import { Ident, Descriptor } from './types';
5export declare type AllDependencies = 'dependencies' | 'devDependencies' | 'peerDependencies';
6export declare type HardDependencies = 'dependencies' | 'devDependencies';
7export interface WorkspaceDefinition {
8 pattern: string;
9}
10export interface DependencyMeta {
11 built?: boolean;
12 optional?: boolean;
13 unplugged?: boolean;
14}
15export interface PeerDependencyMeta {
16 optional?: boolean;
17}
18export interface PublishConfig {
19 access?: string;
20 main?: PortablePath;
21 module?: PortablePath;
22 browser?: PortablePath;
23 bin?: Map<string, PortablePath>;
24 registry?: string;
25 executableFiles?: Set<PortablePath>;
26}
27export declare class Manifest {
28 indent: string;
29 name: Ident | null;
30 version: string | null;
31 os: Array<string> | null;
32 cpu: Array<string> | null;
33 type: string | null;
34 ["private"]: boolean;
35 license: string | null;
36 main: PortablePath | null;
37 module: PortablePath | null;
38 browser: PortablePath | null;
39 languageName: string | null;
40 bin: Map<string, PortablePath>;
41 scripts: Map<string, string>;
42 dependencies: Map<IdentHash, Descriptor>;
43 devDependencies: Map<IdentHash, Descriptor>;
44 peerDependencies: Map<IdentHash, Descriptor>;
45 workspaceDefinitions: Array<WorkspaceDefinition>;
46 dependenciesMeta: Map<string, Map<string | null, DependencyMeta>>;
47 peerDependenciesMeta: Map<string, PeerDependencyMeta>;
48 resolutions: Array<{
49 pattern: Resolution;
50 reference: string;
51 }>;
52 files: Set<PortablePath> | null;
53 publishConfig: PublishConfig | null;
54 preferUnplugged: boolean | null;
55 raw: {
56 [key: string]: any;
57 };
58 /**
59 * errors found in the raw manifest while loading
60 */
61 errors: Array<Error>;
62 static readonly fileName: Filename;
63 static readonly allDependencies: Array<AllDependencies>;
64 static readonly hardDependencies: Array<HardDependencies>;
65 static tryFind(path: PortablePath, { baseFs }?: {
66 baseFs?: FakeFS<PortablePath>;
67 }): Promise<Manifest | null>;
68 static find(path: PortablePath, { baseFs }?: {
69 baseFs?: FakeFS<PortablePath>;
70 }): Promise<Manifest>;
71 static fromFile(path: PortablePath, { baseFs }?: {
72 baseFs?: FakeFS<PortablePath>;
73 }): Promise<Manifest>;
74 static fromText(text: string): Manifest;
75 loadFromText(text: string): void;
76 loadFile(path: PortablePath, { baseFs }: {
77 baseFs?: FakeFS<PortablePath>;
78 }): Promise<void>;
79 load(data: any): void;
80 getForScope(type: string): Map<IdentHash, Descriptor>;
81 hasConsumerDependency(ident: Ident): boolean;
82 hasHardDependency(ident: Ident): boolean;
83 hasSoftDependency(ident: Ident): boolean;
84 hasDependency(ident: Ident): boolean;
85 isCompatibleWithOS(os: string): boolean;
86 isCompatibleWithCPU(cpu: string): boolean;
87 ensureDependencyMeta(descriptor: Descriptor): DependencyMeta;
88 ensurePeerDependencyMeta(descriptor: Descriptor): PeerDependencyMeta;
89 setRawField(name: string, value: any, { after }?: {
90 after?: Array<string>;
91 }): void;
92 exportTo(data: {
93 [key: string]: any;
94 }, { compatibilityMode }?: {
95 compatibilityMode?: boolean;
96 }): {
97 [key: string]: any;
98 };
99}