mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
|
|
import * as GoogleClosureCompiler from 'google-closure-compiler';
|
|
|
|
// See
|
|
// https://github.com/chadkillingsworth/closure-compiler-npm#plugin-authors-and-native-node-usage
|
|
// for the API example. This code tries to do the exact same thing.
|
|
|
|
let ClosureCompiler = GoogleClosureCompiler.compiler;
|
|
|
|
console.log(ClosureCompiler.COMPILER_PATH)
|
|
console.log(ClosureCompiler.CONTRIB_PATH)
|
|
|
|
let options: GoogleClosureCompiler.CompileOptions = {
|
|
js: 'file-one.js',
|
|
compilation_level: 'ADVANCED',
|
|
};
|
|
let closureCompiler = new ClosureCompiler(options);
|
|
let compilerProcess = closureCompiler.run((exitCode, stdout, stderr) => {
|
|
// ...
|
|
});
|
|
|
|
let jsonStream: GoogleClosureCompiler.JSONStreamFile[] = [
|
|
{
|
|
path: 'foo.js',
|
|
src: 'var x = "hello, world";',
|
|
},
|
|
];
|
|
|
|
// Test the various options formats -- see
|
|
// https://github.com/ChadKillingsworth/closure-compiler-npm#specifying-options
|
|
let optionsFormats: GoogleClosureCompiler.CompileOptions = {
|
|
js: ['/file-one.js', '/file-two.js'],
|
|
compilation_level: 'ADVANCED',
|
|
js_output_file: 'out.js',
|
|
debug: true
|
|
};
|