UNPKG

2.72 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 Options = {
47 callToJSON: boolean;
48 escapeRegex: boolean;
49 escapeString: boolean;
50 highlight: boolean;
51 indent: number;
52 maxDepth: number;
53 min: boolean;
54 plugins: Plugins;
55 printBasicPrototype: boolean;
56 printFunctionName: boolean;
57 theme: Theme;
58};
59export interface PrettyFormatOptions {
60 callToJSON?: boolean;
61 escapeRegex?: boolean;
62 escapeString?: boolean;
63 highlight?: boolean;
64 indent?: number;
65 maxDepth?: number;
66 min?: boolean;
67 plugins?: Plugins;
68 printBasicPrototype?: boolean;
69 printFunctionName?: boolean;
70 theme?: ThemeReceived;
71}
72export declare type OptionsReceived = PrettyFormatOptions;
73export declare type Config = {
74 callToJSON: boolean;
75 colors: Colors;
76 escapeRegex: boolean;
77 escapeString: boolean;
78 indent: string;
79 maxDepth: number;
80 min: boolean;
81 plugins: Plugins;
82 printBasicPrototype: boolean;
83 printFunctionName: boolean;
84 spacingInner: string;
85 spacingOuter: string;
86};
87export declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
88declare type Test = (arg0: any) => boolean;
89export declare type NewPlugin = {
90 serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
91 test: Test;
92};
93declare type PluginOptions = {
94 edgeSpacing: string;
95 min: boolean;
96 spacing: string;
97};
98export declare type OldPlugin = {
99 print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
100 test: Test;
101};
102export declare type Plugin = NewPlugin | OldPlugin;
103export declare type Plugins = Array<Plugin>;
104export {};