UNPKG

1.42 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as ts from "typescript";
3import { parseJSON } from "./utils";
4export { parseJSON };
5export declare const version: any;
6export interface Options {
7 dryRun?: boolean;
8 verbose?: boolean;
9 baseDir?: string;
10 replace: boolean;
11 verify: boolean;
12 tsconfig: boolean;
13 tsconfigFile: string | null;
14 tslint: boolean;
15 tslintFile: string | null;
16 editorconfig: boolean;
17 vscode: boolean;
18 vscodeFile: string | null;
19 tsfmt: boolean;
20 tsfmtFile: string | null;
21}
22export interface OptionModifier {
23 (fileName: string, opts: Options, formatSettings: ts.FormatCodeSettings): ts.FormatCodeSettings | Promise<ts.FormatCodeSettings>;
24}
25export interface PostProcessor {
26 (fileName: string, formattedCode: string, opts: Options, formatSettings: ts.FormatCodeSettings): string | Promise<string>;
27}
28export interface ResultMap {
29 [fileName: string]: Result;
30}
31export interface Result {
32 fileName: string;
33 settings: ts.FormatCodeSettings | null;
34 message: string;
35 error: boolean;
36 src: string;
37 dest: string;
38}
39export declare function processFiles(files: string[], opts: Options): Promise<ResultMap>;
40export declare function processStream(fileName: string, input: NodeJS.ReadableStream, opts: Options): Promise<Result>;
41export declare function processString(fileName: string, content: string, opts: Options): Promise<Result>;