UNPKG

3.64 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 | Map<PortablePath, boolean | PortablePath>;
23 bin?: Map<string, PortablePath>;
24 registry?: string;
25 executableFiles?: Set<PortablePath>;
26}
27export interface InstallConfig {
28 hoistingLimits?: string;
29}
30export declare class Manifest {
31 indent: string;
32 name: Ident | null;
33 version: string | null;
34 os: Array<string> | null;
35 cpu: Array<string> | null;
36 type: string | null;
37 ["private"]: boolean;
38 license: string | null;
39 main: PortablePath | null;
40 module: PortablePath | null;
41 browser: PortablePath | Map<PortablePath, boolean | PortablePath> | null;
42 languageName: string | null;
43 bin: Map<string, PortablePath>;
44 scripts: Map<string, string>;
45 dependencies: Map<IdentHash, Descriptor>;
46 devDependencies: Map<IdentHash, Descriptor>;
47 peerDependencies: Map<IdentHash, Descriptor>;
48 workspaceDefinitions: Array<WorkspaceDefinition>;
49 dependenciesMeta: Map<string, Map<string | null, DependencyMeta>>;
50 peerDependenciesMeta: Map<string, PeerDependencyMeta>;
51 resolutions: Array<{
52 pattern: Resolution;
53 reference: string;
54 }>;
55 files: Set<PortablePath> | null;
56 publishConfig: PublishConfig | null;
57 installConfig: InstallConfig | null;
58 preferUnplugged: boolean | null;
59 raw: {
60 [key: string]: any;
61 };
62 /**
63 * errors found in the raw manifest while loading
64 */
65 errors: Array<Error>;
66 static readonly fileName: Filename;
67 static readonly allDependencies: Array<AllDependencies>;
68 static readonly hardDependencies: Array<HardDependencies>;
69 static tryFind(path: PortablePath, { baseFs }?: {
70 baseFs?: FakeFS<PortablePath>;
71 }): Promise<Manifest | null>;
72 static find(path: PortablePath, { baseFs }?: {
73 baseFs?: FakeFS<PortablePath>;
74 }): Promise<Manifest>;
75 static fromFile(path: PortablePath, { baseFs }?: {
76 baseFs?: FakeFS<PortablePath>;
77 }): Promise<Manifest>;
78 static fromText(text: string): Manifest;
79 loadFromText(text: string): void;
80 loadFile(path: PortablePath, { baseFs }: {
81 baseFs?: FakeFS<PortablePath>;
82 }): Promise<void>;
83 load(data: any): void;
84 getForScope(type: string): Map<IdentHash, Descriptor>;
85 hasConsumerDependency(ident: Ident): boolean;
86 hasHardDependency(ident: Ident): boolean;
87 hasSoftDependency(ident: Ident): boolean;
88 hasDependency(ident: Ident): boolean;
89 isCompatibleWithOS(os: string): boolean;
90 isCompatibleWithCPU(cpu: string): boolean;
91 ensureDependencyMeta(descriptor: Descriptor): DependencyMeta;
92 ensurePeerDependencyMeta(descriptor: Descriptor): PeerDependencyMeta;
93 setRawField(name: string, value: any, { after }?: {
94 after?: Array<string>;
95 }): void;
96 exportTo(data: {
97 [key: string]: any;
98 }, { compatibilityMode }?: {
99 compatibilityMode?: boolean;
100 }): {
101 [key: string]: any;
102 };
103}