1 |
|
2 | import { Filename, PortablePath } from '@yarnpkg/fslib';
|
3 | import { Limit } from 'p-limit';
|
4 | import { Writable } from 'stream';
|
5 | import { PeerDependencyMeta } from './Manifest';
|
6 | import { MultiFetcher } from './MultiFetcher';
|
7 | import { MultiResolver } from './MultiResolver';
|
8 | import { Plugin, Hooks } from './Plugin';
|
9 | import { Report } from './Report';
|
10 | import { TelemetryManager } from './TelemetryManager';
|
11 | import * as formatUtils from './formatUtils';
|
12 | import { IdentHash, Package, Descriptor } from './types';
|
13 | export declare const ENVIRONMENT_PREFIX = "yarn_";
|
14 | export declare const DEFAULT_RC_FILENAME: Filename;
|
15 | export declare const DEFAULT_LOCK_FILENAME: Filename;
|
16 | export declare const SECRET = "********";
|
17 | export declare enum SettingsType {
|
18 | ANY = "ANY",
|
19 | BOOLEAN = "BOOLEAN",
|
20 | ABSOLUTE_PATH = "ABSOLUTE_PATH",
|
21 | LOCATOR = "LOCATOR",
|
22 | LOCATOR_LOOSE = "LOCATOR_LOOSE",
|
23 | NUMBER = "NUMBER",
|
24 | STRING = "STRING",
|
25 | SECRET = "SECRET",
|
26 | SHAPE = "SHAPE",
|
27 | MAP = "MAP"
|
28 | }
|
29 | export declare type FormatType = formatUtils.Type;
|
30 | export declare const FormatType: typeof formatUtils.Type;
|
31 | export declare type BaseSettingsDefinition<T extends SettingsType = SettingsType> = {
|
32 | description: string;
|
33 | type: T;
|
34 | isArray?: boolean;
|
35 | };
|
36 | export declare type ShapeSettingsDefinition = BaseSettingsDefinition<SettingsType.SHAPE> & {
|
37 | properties: {
|
38 | [propertyName: string]: SettingsDefinition;
|
39 | };
|
40 | };
|
41 | export declare type MapSettingsDefinition = BaseSettingsDefinition<SettingsType.MAP> & {
|
42 | valueDefinition: SettingsDefinitionNoDefault;
|
43 | normalizeKeys?: (key: string) => string;
|
44 | };
|
45 | export declare type SimpleSettingsDefinition = BaseSettingsDefinition<Exclude<SettingsType, SettingsType.SHAPE | SettingsType.MAP>> & {
|
46 | default: any;
|
47 | defaultText?: any;
|
48 | isNullable?: boolean;
|
49 | values?: Array<any>;
|
50 | };
|
51 | export declare type SettingsDefinitionNoDefault = MapSettingsDefinition | ShapeSettingsDefinition | Omit<SimpleSettingsDefinition, 'default'>;
|
52 | export declare type SettingsDefinition = MapSettingsDefinition | ShapeSettingsDefinition | SimpleSettingsDefinition;
|
53 | export declare type PluginConfiguration = {
|
54 | modules: Map<string, any>;
|
55 | plugins: Set<string>;
|
56 | };
|
57 | export declare const coreDefinitions: {
|
58 | [coreSettingName: string]: SettingsDefinition;
|
59 | };
|
60 | export interface MapConfigurationValue<T extends object> {
|
61 | get<K extends keyof T>(key: K): T[K];
|
62 | }
|
63 | export interface ConfigurationValueMap {
|
64 | lastUpdateCheck: string | null;
|
65 | yarnPath: PortablePath;
|
66 | ignorePath: boolean;
|
67 | ignoreCwd: boolean;
|
68 | cacheKeyOverride: string | null;
|
69 | globalFolder: PortablePath;
|
70 | cacheFolder: PortablePath;
|
71 | compressionLevel: `mixed` | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
72 | virtualFolder: PortablePath;
|
73 | bstatePath: PortablePath;
|
74 | lockfileFilename: Filename;
|
75 | installStatePath: PortablePath;
|
76 | immutablePatterns: Array<string>;
|
77 | rcFilename: Filename;
|
78 | enableGlobalCache: boolean;
|
79 | enableAbsoluteVirtuals: boolean;
|
80 | enableColors: boolean;
|
81 | enableHyperlinks: boolean;
|
82 | enableInlineBuilds: boolean;
|
83 | enableProgressBars: boolean;
|
84 | enableTimers: boolean;
|
85 | preferAggregateCacheInfo: boolean;
|
86 | preferInteractive: boolean;
|
87 | preferTruncatedLines: boolean;
|
88 | progressBarStyle: string | undefined;
|
89 | defaultLanguageName: string;
|
90 | defaultProtocol: string;
|
91 | enableTransparentWorkspaces: boolean;
|
92 | enableMirror: boolean;
|
93 | enableNetwork: boolean;
|
94 | httpProxy: string;
|
95 | httpsProxy: string;
|
96 | unsafeHttpWhitelist: Array<string>;
|
97 | httpTimeout: number;
|
98 | httpRetry: number;
|
99 | networkConcurrency: number;
|
100 | enableTelemetry: boolean;
|
101 | telemetryInterval: number;
|
102 | telemetryUserId: string | null;
|
103 | enableScripts: boolean;
|
104 | enableImmutableCache: boolean;
|
105 | checksumBehavior: string;
|
106 | packageExtensions: Map<string, any>;
|
107 | }
|
108 | declare type SimpleDefinitionForType<T> = SimpleSettingsDefinition & {
|
109 | type: (T extends boolean ? SettingsType.BOOLEAN : never) | (T extends number ? SettingsType.NUMBER : never) | (T extends PortablePath ? SettingsType.ABSOLUTE_PATH : never) | (T extends string ? SettingsType.LOCATOR | SettingsType.LOCATOR_LOOSE | SettingsType.SECRET | SettingsType.STRING : never) | SettingsType.ANY;
|
110 | };
|
111 | declare type DefinitionForTypeHelper<T> = T extends Map<string, infer U> ? (MapSettingsDefinition & {
|
112 | valueDefinition: Omit<DefinitionForType<U>, 'default'>;
|
113 | }) : T extends MapConfigurationValue<infer U> ? (ShapeSettingsDefinition & {
|
114 | properties: ConfigurationDefinitionMap<U>;
|
115 | }) : SimpleDefinitionForType<T>;
|
116 | declare type DefinitionForType<T> = T extends Array<infer U> ? (DefinitionForTypeHelper<U> & {
|
117 | isArray: true;
|
118 | }) : (DefinitionForTypeHelper<T> & {
|
119 | isArray?: false;
|
120 | });
|
121 | export declare type ConfigurationDefinitionMap<V = ConfigurationValueMap> = {
|
122 | [K in keyof V]: DefinitionForType<V[K]>;
|
123 | };
|
124 | declare type SettingTransforms = {
|
125 | hideSecrets: boolean;
|
126 | getNativePaths: boolean;
|
127 | };
|
128 | export declare enum ProjectLookup {
|
129 | LOCKFILE = 0,
|
130 | MANIFEST = 1,
|
131 | NONE = 2
|
132 | }
|
133 | export declare type FindProjectOptions = {
|
134 | lookup?: ProjectLookup;
|
135 | strict?: boolean;
|
136 | usePath?: boolean;
|
137 | useRc?: boolean;
|
138 | };
|
139 | export declare enum PackageExtensionType {
|
140 | Dependency = "Dependency",
|
141 | PeerDependency = "PeerDependency",
|
142 | PeerDependencyMeta = "PeerDependencyMeta"
|
143 | }
|
144 | export declare type PackageExtension = ({
|
145 | type: PackageExtensionType.Dependency;
|
146 | descriptor: Descriptor;
|
147 | } | {
|
148 | type: PackageExtensionType.PeerDependency;
|
149 | descriptor: Descriptor;
|
150 | } | {
|
151 | type: PackageExtensionType.PeerDependencyMeta;
|
152 | selector: string;
|
153 | key: keyof PeerDependencyMeta;
|
154 | value: any;
|
155 | }) & {
|
156 | active: boolean;
|
157 | description: string;
|
158 | };
|
159 | export declare class Configuration {
|
160 | static telemetry: TelemetryManager | null;
|
161 | startingCwd: PortablePath;
|
162 | projectCwd: PortablePath | null;
|
163 | plugins: Map<string, Plugin>;
|
164 | settings: Map<string, SettingsDefinition>;
|
165 | values: Map<string, any>;
|
166 | sources: Map<string, string>;
|
167 | invalid: Map<string, string>;
|
168 | packageExtensions: Map<IdentHash, Array<[string, Array<PackageExtension>]>>;
|
169 | limits: Map<string, Limit>;
|
170 | |
171 |
|
172 |
|
173 |
|
174 |
|
175 | static create(startingCwd: PortablePath, plugins?: Map<string, Plugin>): Configuration;
|
176 | static create(startingCwd: PortablePath, projectCwd: PortablePath | null, plugins?: Map<string, Plugin>): Configuration;
|
177 | |
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 | static find(startingCwd: PortablePath, pluginConfiguration: PluginConfiguration | null, { lookup, strict, usePath, useRc }?: FindProjectOptions): Promise<Configuration>;
|
204 | static findRcFiles(startingCwd: PortablePath): Promise<{
|
205 | path: PortablePath;
|
206 | cwd: PortablePath;
|
207 | data: any;
|
208 | }[]>;
|
209 | static findHomeRcFile(): Promise<{
|
210 | path: PortablePath;
|
211 | cwd: PortablePath;
|
212 | data: any;
|
213 | } | null>;
|
214 | static findProjectCwd(startingCwd: PortablePath, lockfileFilename: Filename | null): Promise<PortablePath | null>;
|
215 | static updateConfiguration(cwd: PortablePath, patch: {
|
216 | [key: string]: ((current: unknown) => unknown) | {} | undefined;
|
217 | } | ((current: {
|
218 | [key: string]: unknown;
|
219 | }) => {
|
220 | [key: string]: unknown;
|
221 | })): Promise<void>;
|
222 | static updateHomeConfiguration(patch: {
|
223 | [key: string]: ((current: unknown) => unknown) | {} | undefined;
|
224 | } | ((current: {
|
225 | [key: string]: unknown;
|
226 | }) => {
|
227 | [key: string]: unknown;
|
228 | })): Promise<void>;
|
229 | private constructor();
|
230 | activatePlugin(name: string, plugin: Plugin): void;
|
231 | private importSettings;
|
232 | useWithSource(source: string, data: {
|
233 | [key: string]: unknown;
|
234 | }, folder: PortablePath, opts?: {
|
235 | strict?: boolean;
|
236 | overwrite?: boolean;
|
237 | }): void;
|
238 | use(source: string, data: {
|
239 | [key: string]: unknown;
|
240 | }, folder: PortablePath, { strict, overwrite }?: {
|
241 | strict?: boolean;
|
242 | overwrite?: boolean;
|
243 | }): void;
|
244 | get<K extends keyof ConfigurationValueMap>(key: K): ConfigurationValueMap[K];
|
245 | /** @deprecated pass in a known configuration key instead */
|
246 | get<T>(key: string): T;
|
247 | /** @note Type will change to unknown in a future major version */
|
248 | get(key: string): any;
|
249 | getSpecial<T = any>(key: string, { hideSecrets, getNativePaths }: Partial<SettingTransforms>): T;
|
250 | getSubprocessStreams(logFile: PortablePath, { header, prefix, report }: {
|
251 | header?: string;
|
252 | prefix: string;
|
253 | report: Report;
|
254 | }): {
|
255 | stdout: Writable;
|
256 | stderr: Writable;
|
257 | };
|
258 | makeResolver(): MultiResolver;
|
259 | makeFetcher(): MultiFetcher;
|
260 | getLinkers(): import("./Linker").Linker[];
|
261 | refreshPackageExtensions(): Promise<void>;
|
262 | normalizePackage(original: Package): Package;
|
263 | getLimit(key: string): Limit;
|
264 | triggerHook<U extends Array<any>, V, HooksDefinition = Hooks>(get: (hooks: HooksDefinition) => ((...args: U) => V) | undefined, ...args: U): Promise<void>;
|
265 | triggerMultipleHooks<U extends Array<any>, V, HooksDefinition = Hooks>(get: (hooks: HooksDefinition) => ((...args: U) => V) | undefined, argsList: Array<U>): Promise<void>;
|
266 | reduceHook<U extends Array<any>, V, HooksDefinition = Hooks>(get: (hooks: HooksDefinition) => ((reduced: V, ...args: U) => Promise<V>) | undefined, initialValue: V, ...args: U): Promise<V>;
|
267 | firstHook<U extends Array<any>, V, HooksDefinition = Hooks>(get: (hooks: HooksDefinition) => ((...args: U) => Promise<V>) | undefined, ...args: U): Promise<Exclude<V, void> | null>;
|
268 | /**
|
269 | * @deprecated Prefer using formatUtils.pretty instead, which is type-safe
|
270 | */
|
271 | format(value: string, formatType: formatUtils.Type | string): string;
|
272 | }
|
273 | export {};
|
274 |
|
\ | No newline at end of file |