ts-runner

0.3.1 • Public • Published

ts-runner

Build Status NPM Version Dependency Status Dev Dependency Status

Executes TypeScript, including references, in node by transpiling to JavaScript on the fly.

API

tsRunner.run(sourcePath, _this, _arguments, options, tempFilename): Compiles TypesScript code and executes in the given node context (supplied by _this and _arguments). Any errors will be passed to console.error.

  • sourcePath (string, required): The path of the TypeScript file to compile. References will be followed.
  • _this (object, required): Object to use as thisArg when executing the compiled JavaScript.
  • _arguments (array, required): The node arguments (exports, require, module, __filename, __dirname) to use when executing the compiled JavaScript.
  • options (string, optional): Options to pass to tsc, for example, '--noImplicitAny'. The default is an empty string.
  • tempFilename (string, optional): The path to a temporary file to pass to tcs. The default is './__temp.js'. This file is deleted immediately after compilitation completes.

Usage

'use strict';

let tsRunner = require('ts-runner');
tsRunner.run('./implementation/index.ts', this, arguments, '--noImplicitAny');

Versions

0.3.1

  • attempt to find correct source path

0.3.0

  • use current version of TypeScript compile

0.2.0

  • update to use tsc full compile

0.1.1 - 0.1.3

  • minor updates - linting, readme (no functional changes)

0.1.0

  • initial implementation

/ts-runner/

    Package Sidebar

    Install

    npm i ts-runner

    Weekly Downloads

    1

    Version

    0.3.1

    License

    MIT

    Last publish

    Collaborators

    • kevinphelps