UNPKG

3.59 kBTypeScriptView Raw
1declare namespace js_beautify {
2 interface CoreBeautifyOptions {
3 disabled?: boolean | undefined;
4 eol?: string | undefined;
5 end_with_newline?: boolean | undefined;
6 indent_size?: number | undefined;
7 indent_char?: string | undefined;
8 indent_level?: number | undefined;
9 preserve_newlines?: boolean | undefined;
10 max_preserve_newlines?: number | undefined;
11 indent_with_tabs?: boolean | undefined;
12 wrap_line_length?: number | undefined;
13 indent_empty_lines?: boolean | undefined;
14 templating?: string[] | undefined;
15 }
16
17 interface JSBeautifyOptions extends CoreBeautifyOptions {
18 brace_style?: "collapse" | "expand" | "end-expand" | "none" | "preserve-inline" | undefined;
19 unindent_chained_methods?: boolean | undefined;
20 break_chained_methods?: boolean | undefined;
21 space_in_paren?: boolean | undefined;
22 space_in_empty_paren?: boolean | undefined;
23 jslint_happy?: boolean | undefined;
24 space_after_anon_function?: boolean | undefined;
25 space_after_named_function?: boolean | undefined;
26 keep_array_indentation?: boolean | undefined;
27 space_before_conditional?: boolean | undefined;
28 unescape_strings?: boolean | undefined;
29 e4x?: boolean | undefined;
30 comma_first?: boolean | undefined;
31 operator_position?: "before-newline" | "after-newline" | "preserve-newline" | undefined;
32 test_output_raw?: boolean | undefined;
33 }
34
35 interface HTMLBeautifyOptions extends CoreBeautifyOptions {
36 templating?: string[] | undefined;
37 indent_inner_html?: boolean | undefined;
38 indent_body_inner_html?: boolean | undefined;
39 indent_head_inner_html?: boolean | undefined;
40 indent_handlebars?: boolean | undefined;
41 wrap_attributes?:
42 | "auto"
43 | "force"
44 | "force-aligned"
45 | "force-expand-multiline"
46 | "aligned-multiple"
47 | "preserve"
48 | "preserve-aligned"
49 | undefined;
50 wrap_attributes_indent_size?: number | undefined;
51 extra_liners?: string[] | undefined;
52 inline?: string[] | undefined;
53 void_elements?: string[] | undefined;
54 unformatted?: string[] | undefined;
55 content_unformatted?: string[] | undefined;
56 unformatted_content_delimiter?: string | undefined;
57 indent_scripts?: "normal" | "keep" | "separate" | undefined;
58 inline_custom_elements?: boolean | undefined;
59 }
60
61 interface CSSBeautifyOptions extends CoreBeautifyOptions {
62 selector_separator_newline?: boolean | undefined;
63 newline_between_rules?: boolean | undefined;
64 space_around_selector_separator?: boolean | undefined;
65 space_around_combinator?: boolean | undefined;
66 }
67}
68
69declare var js_beautify: {
70 (js_source_text: string, options?: js_beautify.JSBeautifyOptions): string;
71 js: (js_source_text: string, options?: js_beautify.JSBeautifyOptions) => string;
72 js_beautify: (js_source_text: string, options?: js_beautify.JSBeautifyOptions) => string;
73
74 css: (js_source_text: string, options?: js_beautify.CSSBeautifyOptions) => string;
75 css_beautify: (js_source_text: string, options?: js_beautify.CSSBeautifyOptions) => string;
76
77 html: (js_source_text: string, options?: js_beautify.HTMLBeautifyOptions) => string;
78 html_beautify: (js_source_text: string, options?: js_beautify.HTMLBeautifyOptions) => string;
79};
80
81export as namespace js_beautify;
82export = js_beautify;