ts-compiler

TypeScript compilation via the typescript-api.

This version is compatable with TypeScript 0.9.5.

Build Status
Dependency Status
NPM version
Views

NPM

TypeScript Usage

```ts
///
import ts = require('ts-compiler');

ts.compile(
['foo.ts', 'bar.ts'],
{ skipWrite: true },
(err: Error, results: ts.OutputFile[]) => {

var foo = results[0];
console.log(foo.text);

var bar = results[1];
console.log(bar.text);

});
```

JavaScript Usage

```js
var ts = require('ts-compiler');

ts.compile(
['foo.ts', 'bar.ts'],
{ skipWrite: true },
function(err, results) {

var foo = results[0];
console.log(foo.text);

var bar = results[1];
console.log(bar.text);

});
```

Module API

ts.compile(globs: string[], options?: ICompilerOptions, callback?: Function)

ts.OutputFile

ts.ICompilerOptions

Though all natively supported TypeScript compiler options will be passed through to the real compiler, it might not always make sense from an API standpoint. Use with common sense.

options.declaration

Generates corresponding .d.ts file.

options.mapRoot

Specifies the location where debugger should locate map files instead of generated locations.

options.module

Specify module code generation: commonjs or amd

options.noImplicitAny

Warn on expressions and declarations with an implied any type.

options.noResolve

Skip resolution and preprocessing.

options.out

Concatenate and emit output to single file.

options.outDir

Redirect output structure to the directory.

options.removeComments

Do not emit comments to output.

options.sourcemap

Generates corresponding .map file.

options.sourceRoot

Specifies the location where debugger should locate TypeScript files instead of source locations.

options.target

Specify ECMAScript target version: 'ES3' or 'ES5'

options.optionsFile

Insert command line options and files from a file. This is natively supported by the tsc command, but as a different @file key.

skipWrite

Skips writing the output files. This flag is unique to ts-compiler.

License

Released under the MIT license.

Bitdeli Badge