Socket
Socket
Sign inDemoInstall

ts-node

Package Overview
Dependencies
Maintainers
1
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-node - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

16

dist/bin/ts-node.js

@@ -33,3 +33,3 @@ var path_1 = require('path');

var isEval = typeof code === 'string' || argv._.length === 0;
var compile = ts_node_1.register({
var service = ts_node_1.register({
getFile: isEval ? getFileEval : ts_node_1.getFile,

@@ -90,3 +90,3 @@ getVersion: isEval ? getVersionEval : ts_node_1.getVersion,

try {
output = compile(EVAL_PATH);
output = service.compile(EVAL_PATH);
}

@@ -126,2 +126,14 @@ catch (error) {

});
repl.defineCommand('type', {
help: 'Check the type of a TypeScript identifier',
action: function (identifier) {
var undo = evalFile.input;
evalFile.input += identifier;
evalFile.version++;
var info = service.getTypeInfo(EVAL_PATH, evalFile.input.length);
repl.outputStream.write(info + "\n");
repl.displayPrompt();
evalFile.input = undo;
}
});
}

@@ -128,0 +140,0 @@ function replEval(code, context, filename, callback) {

5

dist/ts-node.d.ts

@@ -14,3 +14,6 @@ import * as TS from 'typescript';

}
export declare function register(opts?: Options): (fileName: string) => string;
export declare function register(opts?: Options): {
compile: (fileName: string) => string;
getTypeInfo: (fileName: string, position: number) => string;
};
export declare function getVersion(fileName: string): string;

@@ -17,0 +20,0 @@ export declare function getFile(fileName: string): string;

@@ -77,4 +77,7 @@ var __extends = (this && this.__extends) || function (d, b) {

}
function addFileName(fileName) {
files[fileName] = true;
}
function compile(fileName) {
files[fileName] = true;
addFileName(fileName);
var diagnostics = getDiagnostics(service, fileName, options);

@@ -94,6 +97,13 @@ if (!options.disableWarnings && diagnostics.length) {

}
function getTypeInfo(fileName, position) {
addFileName(fileName);
var info = service.getQuickInfoAtPosition(fileName, position);
var name = ts.displayPartsToString(info.displayParts || []);
var comment = ts.displayPartsToString(info.documentation || []);
return chalk.bold(name) + (comment ? os_1.EOL + comment : '');
}
exports.EXTENSIONS.forEach(function (extension) {
require.extensions[extension] = loader;
});
return compile;
return { compile: compile, getTypeInfo: getTypeInfo };
}

@@ -100,0 +110,0 @@ exports.register = register;

{
"name": "ts-node",
"version": "0.2.0",
"version": "0.2.1",
"preferGlobal": true,

@@ -5,0 +5,0 @@ "description": "TypeScript execution environment for node",

@@ -15,3 +15,3 @@ # TypeScript Node

# Make sure you install your TypeScript-compatible compiler.
# Install a TypeScript compiler (requires `typescript` by default).
npm install -g typescript

@@ -22,5 +22,7 @@ ```

* Execute TypeScript with node
![TypeScript REPL](https://github.com/blakeembrey/ts-node/raw/master/screenshot.png)
* Execute TypeScript files with node
* Interactive REPL
* Execute (and print) TypeScript inline
* Execute (and print) TypeScript through the CLI
* Supports source maps

@@ -35,13 +37,13 @@ * Supports `tsconfig.json`

# Start a TypeScript REPL
# Start the TypeScript REPL.
ts-node
# Execute code snippets with TypeScript
# Execute code snippets with TypeScript.
ts-node -e 'console.log("Hello, world!")'
# Execute and print code snippets with TypeScript
# Execute and print code snippets with TypeScript.
ts-node -p '"Hello, world!"'
```
**With Mocha**
**Mocha:**

@@ -52,3 +54,3 @@ ```

**With Tape:**
**Tape:**

@@ -59,14 +61,5 @@ ```

### Using TypeScript With Node Programmatically
```js
require('ts-node').register({ /* options */ })
// Or using the shortcut file.
require('ts-node/register')
```
### Loading `tsconfig.json`
**Typescript Node** automatically loads `tsconfig.json` options and files from the current directory using [tsconfig](https://github.com/TypeStrong/tsconfig).
**Typescript Node** automatically loads `tsconfig.json` options and referenced files from the current directory using [tsconfig](https://github.com/TypeStrong/tsconfig).

@@ -86,2 +79,11 @@ ### Configuration Options

### Programmatic Usage
```js
require('ts-node').register({ /* options */ })
// Or using the shortcut file.
require('ts-node/register')
```
## License

@@ -88,0 +90,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with тЪбя╕П by Socket Inc