DefinitelyTyped/types/google-closure-compiler/index.d.ts
2017-03-24 14:27:52 -07:00

42 lines
1.3 KiB
TypeScript

// Type definitions for google-closure-compiler
// Project: https://github.com/chadkillingsworth/closure-compiler-npm
// Definitions by: Evan Martin <http://neugierig.org>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
// Note: the types seen in the JSDoc are wrong:
// https://github.com/ChadKillingsworth/closure-compiler-npm/issues/21
// Be careful to read the code when choosing types.
import * as child_process from 'child_process';
// The "json_streams" compiler flag lets the compiler accept/produce
// arrays of JSON objects in this shape for input/output.
interface JSONStreamFile {
path: string;
src: string;
srcmap?: string; // TODO(evan): pass through source maps.
}
interface Compiler {
javaPath: string;
logger: (...args: any[]) => void;
spawnOptions: { [key: string]: string };
run(callback?: (exitCode: number, stdout: string, stderr: string) => void):
child_process.ChildProcess;
getFullCommand(): string;
}
type CompileOption = string | boolean;
type CompileOptions = string[] | {[key: string]: (CompileOption|CompileOption[])};
export var compiler: {
new (opts: (CompileOptions | string[]), extraCommandArgs?: string[]): Compiler;
JAR_PATH: string;
COMPILER_PATH: string;
CONTRIB_PATH: string;
};