UNPKG

1.92 kBTypeScriptView Raw
1import { CancellablePromise } from '@theintern/common';
2import { Config } from './config';
3import { Executor } from '../executors/Executor';
4import { InternError } from '../types';
5export interface EvaluatedProperty {
6 name: keyof Config;
7 addToExisting: boolean;
8}
9export interface TextLoader {
10 (path: string): CancellablePromise<string>;
11}
12export declare type TypeName = 'string' | 'boolean' | 'number' | 'regexp' | 'object' | 'string[]' | 'object[]';
13export declare type Parser<T = any> = (value: any) => T;
14export declare function evalProperty<C>(key: keyof C): EvaluatedProperty;
15export declare function getBasePath(configFile: string, basePath: string, isAbsolute: (path: string) => boolean, pathSep?: string): string;
16export declare function getConfigDescription(config: any, prefix?: string): string;
17export declare function loadConfig(configPath: string, loadText: TextLoader, args?: {
18 [key: string]: any;
19}, childConfig?: string | string[]): CancellablePromise<any>;
20export declare function parseArgs(rawArgs: string[]): {
21 [key: string]: any;
22};
23export declare function parseJson(json: string): any;
24export declare function parseValue(name: string, value: any, parser: TypeName | Parser, requiredProperty?: string): any;
25export declare function prefix(message: string, prefix: string): string;
26export declare function processOption<C extends Config>(key: keyof C, value: any, config: C, executor?: Executor): void;
27export declare function pullFromArray<T>(haystack: T[], needle: T): T[];
28export declare function setOption(config: Config, name: keyof Config, value: any, addToExisting?: boolean): void;
29export declare function splitConfigPath(path: string, separator?: string): {
30 configFile: string;
31 childConfig?: string;
32};
33export declare function stringify(object: Object, indent?: string): string;
34export declare function errorToJSON(error?: InternError): InternError | undefined;