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.6.1
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.7.0
Choose a head ref
  • 4 commits
  • 4 files changed
  • 3 contributors

Commits on Oct 29, 2016

  1. Support --nolazy V8 flag (#228)

    Llorx authored and blakeembrey committed Oct 29, 2016
    Copy the full SHA
    4e3f91f View commit details

Commits on Nov 1, 2016

  1. chore: drop support for Node.js 0.10 (#231)

    BREAKING CHANGE: This module no longer supports Node.js 0.10
    greenkeeperio-bot authored and blakeembrey committed Nov 1, 2016
    Copy the full SHA
    100ca8e View commit details

Commits on Nov 7, 2016

  1. Refactor bin file, use v8flags

    Closes #230
    blakeembrey committed Nov 7, 2016
    Copy the full SHA
    3c3ebb1 View commit details
  2. v1.7.0

    blakeembrey committed Nov 7, 2016
    Copy the full SHA
    840cb16 View commit details
Showing with 58 additions and 55 deletions.
  1. +2 −4 .travis.yml
  2. +2 −1 package.json
  3. +53 −50 src/bin.ts
  4. +1 −0 typings.json
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -19,9 +19,7 @@ env:
- TYPESCRIPT=typescript@next

node_js:
- "0.12"
- "iojs"
- "4"
- "stable"
- '4'
- stable

after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-node",
"version": "1.6.1",
"version": "1.7.0",
"preferGlobal": true,
"description": "TypeScript execution environment and REPL for node",
"main": "dist/index.js",
@@ -65,6 +65,7 @@
"pinkie": "^2.0.4",
"source-map-support": "^0.4.0",
"tsconfig": "^5.0.2",
"v8flags": "^2.0.11",
"xtend": "^4.0.0",
"yn": "^1.2.0"
}
103 changes: 53 additions & 50 deletions src/bin.ts
Original file line number Diff line number Diff line change
@@ -2,63 +2,66 @@

import { spawn } from 'child_process'
import { join } from 'path'
import v8flags = require('v8flags')

const args = [join(__dirname, '_bin.js')]
const opts = process.argv.slice(2)
const argv = process.argv.slice(2)

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

switch (flag) {
case '-d':
args.unshift('--debug')
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':
case '--prof':
case '--log-timer-events':
case '--throw-deprecation':
case '--trace-deprecation':
case '--use_strict':
case '--allow-natives-syntax':
case '--perf-basic-prof':
args.unshift(arg)
opts.splice(i, 1)
break
default:
if (/^--(?:harmony|trace|icu-data-dir|max-old-space-size)/.test(arg)) {
args.unshift(arg)
opts.splice(i, 1)
}
break
v8flags(function (err, v8flags) {
if (err) {
console.error(err.stack)
process.exit(1)
return
}

// Stop on first non-argument because it's the script name.
if (/^[^-]/.test(arg)) {
break
}
}
const nodeArgs: string[] = []
const scriptArgs: string[] = []

const proc = spawn(process.execPath, args.concat(opts), { stdio: 'inherit' })
const knownFlags = v8flags.concat([
'debug',
'--debug',
'--debug-brk',
'--inspect',
'--nolazy',
'--no-deprecation',
'--log-timer-events',
'--throw-deprecation',
'--trace-deprecation',
'--allow-natives-syntax',
'--perf-basic-prof'
])

proc.on('exit', function (code: number, signal: string) {
process.on('exit', function () {
if (signal) {
process.kill(process.pid, signal)
for (let i = 0; i < argv.length; i++) {
const arg = argv[i]
const flag = arg.split('=', 1)[0]

if (flag === '-d') {
nodeArgs.push('--debug')
} else if (flag === '-gc') {
nodeArgs.push('--expose-gc')
} else if (knownFlags.indexOf(flag) > -1) {
nodeArgs.push(arg)
} else if (/^-/.test(flag)) {
scriptArgs.push(arg)
} else {
process.exit(code)
// Break when we encounter a "script".
scriptArgs.push(...argv.slice(i))
break
}
}

const proc = spawn(
process.execPath,
nodeArgs.concat(join(__dirname, '_bin.js'), scriptArgs),
{ stdio: 'inherit' }
)

proc.on('exit', function (code: number, signal: string) {
process.on('exit', function () {
if (signal) {
process.kill(process.pid, signal)
} else {
process.exit(code)
}
})
})
})
1 change: 1 addition & 0 deletions typings.json
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
"proxyquire": "registry:npm/proxyquire#1.0.0+20160211003958",
"source-map-support": "registry:npm/source-map-support#0.3.0+20161006200546",
"tsconfig": "npm:tsconfig",
"v8flags": "registry:npm/v8flags#3.0.0+20161011212142",
"xtend": "registry:npm/xtend#4.0.0+20160211003958",
"yn": "registry:npm/yn#1.2.0+20161006191459"
},