steve8708-typescript-register
v1.1.5
Published
Extension to require TypeScript files from Node
Downloads
6
Readme
TypeScript Register
Extension to require TypeScript files from Node. This project is an alternative to typescript-require. The main differences are:
- Dependencies are run in the same context as the parent
- Uses the TypeScript API as opposed to forking
tsc
- Caches dependencies in
/tmp/typescript-register/:your/:path/:here
Examples
foo.ts
export var foo = 3;
bar.js
require('typescript-register');
var foo = require('./foo');
console.log(foo.foo);
Installation
Install with npm:
npm install typescript-register
Configuration
There are three configuration options which are read from environment variables. The configuration options are read each time a module is required so you can programatically set them with:
process.env[':name'] = ':value';
The values are:
TYPESCRIPT_REGISTER_EMIT_ERROR
: Whether or not emit fatal TypeScript errorsTYPESCRIPT_REGISTER_USE_CACHE
: Whether or not to use previously emitted filesTYPESCRIPT_REGISTER_COMPILER_OPTIONS
: The JSON stringified TypeScript compiler options
Contributing
Feel free to fork and submit pull requests for the code! Please follow the existing code as an example of style and make sure that all your code passes tests.