Comparing version 0.6.2 to 0.7.0
@@ -33,5 +33,5 @@ "use strict"; | ||
}, result.config.compilerOptions, { | ||
sourceMap: true, | ||
inlineSourceMap: false, | ||
inlineSources: false, | ||
sourceMap: false, | ||
inlineSourceMap: true, | ||
inlineSources: true, | ||
declaration: false, | ||
@@ -114,10 +114,3 @@ noEmit: false | ||
} | ||
var result = output.outputFiles[1].text; | ||
var sourceText = service.getSourceFile(fileName).text; | ||
var sourceMapText = output.outputFiles[0].text; | ||
var sourceMapFileName = output.outputFiles[0].name; | ||
var sourceMap = getSourceMap(sourceMapText, fileName, sourceText); | ||
var base64SourceMapText = new Buffer(sourceMap).toString('base64'); | ||
return result | ||
.replace('//# sourceMappingURL=' + path_1.basename(sourceMapFileName), "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText); | ||
return output.outputFiles[0].text; | ||
} | ||
@@ -180,10 +173,2 @@ function compile(fileName) { | ||
} | ||
function getSourceMap(map, fileName, code) { | ||
var sourceMap = JSON.parse(map); | ||
sourceMap.file = fileName; | ||
sourceMap.sources = [fileName]; | ||
sourceMap.sourcesContent = [code]; | ||
delete sourceMap.sourceRoot; | ||
return JSON.stringify(sourceMap); | ||
} | ||
var TSError = (function (_super) { | ||
@@ -190,0 +175,0 @@ __extends(TSError, _super); |
@@ -8,3 +8,4 @@ "use strict"; | ||
var cwd = path_1.join(__dirname, '../src'); | ||
var BIN_EXEC = "node " + path_1.join(__dirname, '../dist/bin/ts-node') + " --project \"" + cwd + "\""; | ||
var EXEC_PATH = path_1.join(__dirname, '../dist/bin/ts-node'); | ||
var BIN_EXEC = "node " + EXEC_PATH + " --project \"" + cwd + "\""; | ||
describe('ts-node', function () { | ||
@@ -52,3 +53,3 @@ this.timeout(10000); | ||
chai_1.expect(err.message).to.contain([ | ||
(path_1.join(__dirname, '../tests/throw.ts') + ":3"), | ||
(path_1.normalize('../../tests/throw.ts') + ":3"), | ||
' bar () { throw new Error(\'this is a demo\') }', | ||
@@ -64,3 +65,3 @@ ' ^', | ||
chai_1.expect(err.message).to.contain([ | ||
(path_1.join(__dirname, '../tests/throw.ts') + ":3"), | ||
(path_1.normalize('../../tests/throw.ts') + ":3"), | ||
' bar () { throw new Error(\'this is a demo\') }', | ||
@@ -124,3 +125,3 @@ ' ^', | ||
'Error: this is a demo', | ||
(" at Foo.bar (" + path_1.join(__dirname, '../tests/throw.ts') + ":3:18)") | ||
(" at Foo.bar (" + path_1.normalize('../../tests/throw.ts') + ":3:18)") | ||
].join('\n')); | ||
@@ -127,0 +128,0 @@ done(); |
{ | ||
"name": "ts-node", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"preferGlobal": true, | ||
@@ -5,0 +5,0 @@ "description": "TypeScript execution environment and REPL for node", |
@@ -36,12 +36,17 @@ # TypeScript Node | ||
# Execute code snippets with TypeScript. | ||
# Execute code with TypeScript. | ||
ts-node -e 'console.log("Hello, world!")' | ||
# Execute and print code snippets with TypeScript. | ||
# Execute, and print, code with TypeScript. | ||
ts-node -p '"Hello, world!"' | ||
# Pipe scripts to execute with TypeScript. | ||
echo "console.log('Hello, world!')" | ts-node | ||
``` | ||
![TypeScript REPL](https://github.com/TypeStrong/ts-node/raw/master/screenshot.png) | ||
### Mocha | ||
``` | ||
```sh | ||
mocha test.ts --require ts-node/register src/**/*.spec.ts | ||
@@ -52,11 +57,16 @@ ``` | ||
``` | ||
```sh | ||
ts-node node_modules/tape/bin/tape src/**/*.spec.ts | ||
``` | ||
![TypeScript REPL](https://github.com/TypeStrong/ts-node/raw/master/screenshot.png) | ||
### Gulp | ||
```sh | ||
# Just create a `gulpfile.ts` and run `gulp`. | ||
gulp | ||
``` | ||
### Loading `tsconfig.json` | ||
**Typescript Node** automatically loads `tsconfig.json` options and referenced files from the current directory using [tsconfig](https://github.com/TypeStrong/tsconfig). | ||
**Typescript Node** uses `tsconfig.json` automatically, use `-n` to skip loading `tsconfig.json`. | ||
@@ -71,7 +81,7 @@ ### Configuration Options | ||
* **project** Location to resolve `tsconfig.json` from (also `process.env.TS_NODE_PROJECT`) | ||
* **noProject** Disable loading `tsconfig.json` (also `process.env.TS_NODE_NO_PROJECT`) | ||
* **compiler** Use a custom, require-able TypeScript compiler compatible with `typescript@>=1.5.0-alpha` (also `process.env.TS_NODE_COMPILER`) | ||
* **ignoreWarnings** Set an array of TypeScript diagnostic codes to ignore (also `process.env.TS_NODE_IGNORE_WARNINGS`) | ||
* **disableWarnings** Ignore all TypeScript errors (also `process.env.TS_NODE_DISABLE_WARNINGS`) | ||
* **--project, -P** Location to resolve `tsconfig.json` from (also `process.env.TS_NODE_PROJECT`) | ||
* **--noProject, -n** Disable loading `tsconfig.json` (also `process.env.TS_NODE_NO_PROJECT`) | ||
* **--compiler, -c** Use a custom, require-able TypeScript compiler compatible with `typescript@>=1.5.0-alpha` (also `process.env.TS_NODE_COMPILER`) | ||
* **--ignoreWarnings, -i** Set an array of TypeScript diagnostic codes to ignore (also `process.env.TS_NODE_IGNORE_WARNINGS`) | ||
* **--disableWarnings, -d** Ignore all TypeScript errors (also `process.env.TS_NODE_DISABLE_WARNINGS`) | ||
@@ -78,0 +88,0 @@ ### Programmatic Usage |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106
45900
554