Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TypeStrong/ts-node
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.4.2
Choose a base ref
...
head repository: TypeStrong/ts-node
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.4.3
Choose a head ref
  • 4 commits
  • 7 files changed
  • 2 contributors

Commits on Oct 11, 2016

  1. Compare options from reading config (#217)

    srolel authored and blakeembrey committed Oct 11, 2016
    Copy the full SHA
    4aff7d7 View commit details
  2. Support --inspect flag

    Closes #218
    blakeembrey committed Oct 11, 2016
    Copy the full SHA
    d764777 View commit details
  3. Copy the full SHA
    1d695b8 View commit details
  4. v1.4.3

    blakeembrey committed Oct 11, 2016
    Copy the full SHA
    a059159 View commit details
Showing with 29 additions and 59 deletions.
  1. +0 −27 custom_typings/node.d.ts
  2. +1 −1 package.json
  3. +8 −8 src/_bin.ts
  4. +5 −7 src/bin.ts
  5. +2 −2 src/index.spec.ts
  6. +12 −12 src/index.ts
  7. +1 −2 typings.json
27 changes: 0 additions & 27 deletions custom_typings/node.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-node",
"version": "1.4.2",
"version": "1.4.3",
"preferGlobal": true,
"description": "TypeScript execution environment and REPL for node",
"main": "dist/index.js",
16 changes: 8 additions & 8 deletions src/_bin.ts
Original file line number Diff line number Diff line change
@@ -211,16 +211,16 @@ if (isEvalScript) {
* Evaluate a script.
*/
function evalAndExit (code: string, isPrinted: boolean) {
global.__filename = EVAL_FILENAME
global.__dirname = cwd
;(global as any).__filename = EVAL_FILENAME
;(global as any).__dirname = cwd

const module = new Module(global.__filename)
module.filename = global.__filename
module.paths = Module._nodeModulePaths(global.__dirname)
const module = new Module((global as any).__filename)
module.filename = (global as any).__filename
module.paths = Module._nodeModulePaths((global as any).__dirname)

global.exports = module.exports
global.module = module
global.require = module.require.bind(module)
;(global as any).exports = module.exports
;(global as any).module = module
;(global as any).require = module.require.bind(module)

let result: any

12 changes: 5 additions & 7 deletions src/bin.ts
Original file line number Diff line number Diff line change
@@ -8,24 +8,22 @@ const opts = process.argv.slice(2)

for (let i = 0; i < opts.length; i++) {
const arg = opts[i]
const flag = arg.split('=')[0]
const flag = arg.split('=', 1)[0]

switch (flag) {
case '-d':
args.unshift('--debug')
opts.splice(i, 1)
break
case 'debug':
case '--debug':
case '--debug-brk':
args.unshift(arg)
opts.splice(i, 1)
break
case '-gc':
case '--expose-gc':
args.unshift('--expose-gc')
opts.splice(i, 1)
break
case 'debug':
case '--debug':
case '--debug-brk':
case '--inspect':
case '--gc-global':
case '--es_staging':
case '--no-deprecation':
4 changes: 2 additions & 2 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -216,10 +216,10 @@ describe('ts-node', function () {
let compiled: string

before(function () {
require.extensions['.tsx'] = (m: any, fileName: string) => {
require.extensions['.tsx'] = (m, fileName) => {
const _compile = m._compile

m._compile = (code: string, fileName: string) => {
m._compile = (code, fileName) => {
compiled = code
return _compile.call(this, code, fileName)
}
24 changes: 12 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -94,15 +94,15 @@ export interface TypeInfo {
const DEFAULTS = {
getFile,
fileExists,
cache: yn(process.env.TS_NODE_CACHE),
cacheDirectory: process.env.TS_NODE_CACHE_DIRECTORY,
disableWarnings: yn(process.env.TS_NODE_DISABLE_WARNINGS),
compiler: process.env.TS_NODE_COMPILER,
compilerOptions: parse(process.env.TS_NODE_COMPILER_OPTIONS),
project: process.env.TS_NODE_PROJECT,
ignore: split(process.env.TS_NODE_IGNORE),
ignoreWarnings: split(process.env.TS_NODE_IGNORE_WARNINGS),
fast: yn(process.env.TS_NODE_FAST)
cache: yn(process.env['TS_NODE_CACHE']),
cacheDirectory: process.env['TS_NODE_CACHE_DIRECTORY'],
disableWarnings: yn(process.env['TS_NODE_DISABLE_WARNINGS']),
compiler: process.env['TS_NODE_COMPILER'],
compilerOptions: parse(process.env['TS_NODE_COMPILER_OPTIONS']),
project: process.env['TS_NODE_PROJECT'],
ignore: split(process.env['TS_NODE_IGNORE']),
ignoreWarnings: split(process.env['TS_NODE_IGNORE_WARNINGS']),
fast: yn(process.env['TS_NODE_FAST'])
}

/**
@@ -208,7 +208,7 @@ export function register (options: Options = {}): () => Register {
* Get the extension for a transpiled file.
*/
function getExtension (fileName: string) {
if (compilerOptions.jsx === 'preserve' && extname(fileName) === '.tsx') {
if (config.options.jsx === ts.JsxEmit.Preserve && extname(fileName) === '.tsx') {
return '.jsx'
}

@@ -381,14 +381,14 @@ function shouldIgnore (filename: string, service: () => Register, ignore: RegExp
function registerExtension (ext: string, ignore: RegExp[], service: () => Register) {
const old = require.extensions[ext] || require.extensions['.js']

require.extensions[ext] = function (m: any, filename: string) {
require.extensions[ext] = function (m, filename) {
if (shouldIgnore(filename, service, ignore)) {
return old(m, filename)
}

const _compile = m._compile

m._compile = function (code: string, fileName: string) {
m._compile = function (code, fileName) {
return _compile.call(this, service().compile(code, fileName), fileName)
}

3 changes: 1 addition & 2 deletions typings.json
Original file line number Diff line number Diff line change
@@ -13,8 +13,7 @@
"yn": "registry:npm/yn#1.2.0+20161006191459"
},
"globalDependencies": {
"node": "github:borisyankov/DefinitelyTyped/node/node.d.ts#b37afda34daa6186c3f143609555fcd6d70b249f",
"node-extended": "file:custom_typings/node.d.ts"
"node": "registry:env/node#6.0.0+20161011193755"
},
"globalDevDependencies": {
"chai": "registry:dt/chai#3.4.0+20160216071402",