UNPKG

3.1 kBTypeScriptView Raw
1import { Configuration } from './Configuration';
2import { Descriptor, Locator, Ident } from './types';
3export declare enum Type {
4 NO_HINT = "NO_HINT",
5 NULL = "NULL",
6 SCOPE = "SCOPE",
7 NAME = "NAME",
8 RANGE = "RANGE",
9 REFERENCE = "REFERENCE",
10 NUMBER = "NUMBER",
11 PATH = "PATH",
12 URL = "URL",
13 ADDED = "ADDED",
14 REMOVED = "REMOVED",
15 CODE = "CODE",
16 DURATION = "DURATION",
17 SIZE = "SIZE",
18 IDENT = "IDENT",
19 DESCRIPTOR = "DESCRIPTOR",
20 LOCATOR = "LOCATOR",
21 RESOLUTION = "RESOLUTION",
22 DEPENDENT = "DEPENDENT"
23}
24export declare enum Style {
25 BOLD = 2
26}
27export declare const supportsColor: boolean;
28export declare const supportsHyperlinks: boolean;
29declare const transforms: {
30 NUMBER: {
31 pretty: (configuration: any, val: number) => string;
32 json: (val: number) => any;
33 };
34 IDENT: {
35 pretty: (configuration: any, val: Ident) => string;
36 json: (val: Ident) => any;
37 };
38 LOCATOR: {
39 pretty: (configuration: any, val: Locator) => string;
40 json: (val: Locator) => any;
41 };
42 DESCRIPTOR: {
43 pretty: (configuration: any, val: Descriptor) => string;
44 json: (val: Descriptor) => any;
45 };
46 RESOLUTION: {
47 pretty: (configuration: any, val: {
48 descriptor: Descriptor;
49 locator: Locator | null;
50 }) => string;
51 json: (val: {
52 descriptor: Descriptor;
53 locator: Locator | null;
54 }) => any;
55 };
56 DEPENDENT: {
57 pretty: (configuration: any, val: {
58 locator: Locator;
59 descriptor: Descriptor;
60 }) => string;
61 json: (val: {
62 locator: Locator;
63 descriptor: Descriptor;
64 }) => any;
65 };
66 DURATION: {
67 pretty: (configuration: any, val: number) => string;
68 json: (val: number) => any;
69 };
70 SIZE: {
71 pretty: (configuration: any, val: number) => string;
72 json: (val: number) => any;
73 };
74 PATH: {
75 pretty: (configuration: any, val: string) => string;
76 json: (val: string) => any;
77 };
78};
79declare type AllTransforms = typeof transforms;
80export declare type Source<T> = T extends keyof AllTransforms ? Parameters<AllTransforms[T]['json']>[0] | null : string | null;
81export declare type Tuple<T extends Type = Type> = readonly [Source<T>, T];
82export declare function tuple<T extends Type>(formatType: T, value: Source<T>): Tuple<T>;
83export declare function applyStyle(configuration: Configuration, text: string, flags: Style): string;
84export declare function applyColor(configuration: Configuration, value: string, formatType: Type | string): string;
85export declare function pretty<T extends Type>(configuration: Configuration, value: Source<T>, formatType: T | string): string;
86export declare function prettyList<T extends Type>(configuration: Configuration, values: Iterable<Source<T>>, formatType: T | string, { separator }?: {
87 separator?: string;
88}): string;
89export declare function json<T extends Type>(value: Source<T>, formatType: T | string): any;
90export {};