UNPKG

2.9 kBTypeScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7export declare type Colors = {
8 comment: {
9 close: string;
10 open: string;
11 };
12 content: {
13 close: string;
14 open: string;
15 };
16 prop: {
17 close: string;
18 open: string;
19 };
20 tag: {
21 close: string;
22 open: string;
23 };
24 value: {
25 close: string;
26 open: string;
27 };
28};
29declare type Indent = (arg0: string) => string;
30export declare type Refs = Array<unknown>;
31declare type Print = (arg0: unknown) => string;
32export declare type Theme = {
33 comment: string;
34 content: string;
35 prop: string;
36 tag: string;
37 value: string;
38};
39declare type ThemeReceived = {
40 comment?: string;
41 content?: string;
42 prop?: string;
43 tag?: string;
44 value?: string;
45};
46export declare type CompareKeys = ((a: string, b: string) => number) | undefined;
47export declare type Options = {
48 callToJSON: boolean;
49 compareKeys: CompareKeys;
50 escapeRegex: boolean;
51 escapeString: boolean;
52 highlight: boolean;
53 indent: number;
54 maxDepth: number;
55 min: boolean;
56 plugins: Plugins;
57 printBasicPrototype: boolean;
58 printFunctionName: boolean;
59 theme: Theme;
60};
61export interface PrettyFormatOptions {
62 callToJSON?: boolean;
63 compareKeys?: CompareKeys;
64 escapeRegex?: boolean;
65 escapeString?: boolean;
66 highlight?: boolean;
67 indent?: number;
68 maxDepth?: number;
69 min?: boolean;
70 plugins?: Plugins;
71 printBasicPrototype?: boolean;
72 printFunctionName?: boolean;
73 theme?: ThemeReceived;
74}
75export declare type OptionsReceived = PrettyFormatOptions;
76export declare type Config = {
77 callToJSON: boolean;
78 compareKeys: CompareKeys;
79 colors: Colors;
80 escapeRegex: boolean;
81 escapeString: boolean;
82 indent: string;
83 maxDepth: number;
84 min: boolean;
85 plugins: Plugins;
86 printBasicPrototype: boolean;
87 printFunctionName: boolean;
88 spacingInner: string;
89 spacingOuter: string;
90};
91export declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
92declare type Test = (arg0: any) => boolean;
93export declare type NewPlugin = {
94 serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
95 test: Test;
96};
97declare type PluginOptions = {
98 edgeSpacing: string;
99 min: boolean;
100 spacing: string;
101};
102export declare type OldPlugin = {
103 print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
104 test: Test;
105};
106export declare type Plugin = NewPlugin | OldPlugin;
107export declare type Plugins = Array<Plugin>;
108export {};