1 |
|
2 | import { PortablePath } from '@yarnpkg/fslib';
|
3 | import { Readable, Transform } from 'stream';
|
4 | export declare function escapeRegExp(str: string): string;
|
5 | export declare function overrideType<T>(val: unknown): asserts val is T;
|
6 | export declare function assertNever(arg: never): never;
|
7 | export declare function validateEnum<T>(def: {
|
8 | [key: string]: T;
|
9 | }, value: string): T;
|
10 | export declare function mapAndFilter<In, Out>(iterable: Iterable<In>, cb: (value: In) => Out | typeof mapAndFilterSkip): Array<Out>;
|
11 | export declare namespace mapAndFilter {
|
12 | var skip: typeof mapAndFilterSkip;
|
13 | }
|
14 | declare const mapAndFilterSkip: unique symbol;
|
15 | export declare function mapAndFind<In, Out>(iterable: Iterable<In>, cb: (value: In) => Out | typeof mapAndFindSkip): Out | undefined;
|
16 | export declare namespace mapAndFind {
|
17 | var skip: typeof mapAndFindSkip;
|
18 | }
|
19 | declare const mapAndFindSkip: unique symbol;
|
20 | export declare function isIndexableObject(value: unknown): value is {
|
21 | [key: string]: unknown;
|
22 | };
|
23 | export declare function getFactoryWithDefault<K, T>(map: Map<K, T>, key: K, factory: () => T): T;
|
24 | export declare function getArrayWithDefault<K, T>(map: Map<K, Array<T>>, key: K): T[];
|
25 | export declare function getSetWithDefault<K, T>(map: Map<K, Set<T>>, key: K): Set<T>;
|
26 | export declare function getMapWithDefault<K, MK, MV>(map: Map<K, Map<MK, MV>>, key: K): Map<MK, MV>;
|
27 | export declare function releaseAfterUseAsync<T>(fn: () => Promise<T>, cleanup?: (() => any) | null): Promise<T>;
|
28 | export declare function prettifyAsyncErrors<T>(fn: () => Promise<T>, update: (message: string) => string): Promise<T>;
|
29 | export declare function prettifySyncErrors<T>(fn: () => T, update: (message: string) => string): T;
|
30 | export declare function bufferStream(stream: Readable): Promise<Buffer>;
|
31 | export declare class BufferStream extends Transform {
|
32 | private readonly chunks;
|
33 | _transform(chunk: Buffer, encoding: string, cb: any): void;
|
34 | _flush(cb: any): void;
|
35 | }
|
36 | export declare class DefaultStream extends Transform {
|
37 | private readonly ifEmpty;
|
38 | active: boolean;
|
39 | constructor(ifEmpty?: Buffer);
|
40 | _transform(chunk: Buffer, encoding: string, cb: any): void;
|
41 | _flush(cb: any): void;
|
42 | }
|
43 | export declare function dynamicRequire(path: string): any;
|
44 | export declare function dynamicRequireNoCache(path: PortablePath): any;
|
45 | export declare function sortMap<T>(values: Iterable<T>, mappers: ((value: T) => string) | Array<(value: T) => string>): T[];
|
46 | /**
|
47 | * Combines an Array of glob patterns into a regular expression.
|
48 | *
|
49 | * @param ignorePatterns An array of glob patterns
|
50 | *
|
51 | * @returns A `string` representing a regular expression or `null` if no glob patterns are provided
|
52 | */
|
53 | export declare function buildIgnorePattern(ignorePatterns: Array<string>): string | null;
|
54 | export declare function replaceEnvVariables(value: string, { env }: {
|
55 | env: {
|
56 | [key: string]: string | undefined;
|
57 | };
|
58 | }): string;
|
59 | export {};
|