ts-node-dev
Advanced tools
Comparing version
@@ -9,2 +9,3 @@ var fs = require('fs') | ||
var preferTs = false | ||
var ignore = /node_modules/ | ||
@@ -65,3 +66,4 @@ var compile = (code, fileName) => { | ||
var _compile = m._compile | ||
if (tsCode !== undefined || allowJs) { | ||
var isIgnored = ignore && ignore.test(fileName) | ||
if (tsCode !== undefined || (allowJs && !isIgnored)) { | ||
m._compile = function (code, fileName) { | ||
@@ -68,0 +70,0 @@ if (tsCode !== undefined) { |
@@ -42,3 +42,8 @@ var register = require('ts-node').register | ||
} | ||
fileData = fileData.replace('var compiledDir', 'var compiledDir = "' + compiler.getCompiledDir() + '"') | ||
if (options['ignore']) { | ||
var ignore = options['ignore'] | ||
var ignoreVal = ignore === 'false' ? 'false' : 'new RegExp("' + ignore + '")' | ||
fileData = fileData.replace(/var ignore = .*$/, 'var ignore = ' + ignoreVal) | ||
} | ||
fileData = fileData.replace('var compiledDir', 'var compiledDir = "' + compiler.getCompiledDir() + '"') | ||
fileData = fileData.replace('./get-compiled-path', path.join(__dirname, 'get-compiled-path').replace(/\\/g, '/')) | ||
@@ -57,3 +62,3 @@ fs.writeFileSync(compiler.getChildHookPath(), fileData) | ||
: path.join(os.tmpdir(), '.ts-node') | ||
var tsNodeOptions = { | ||
@@ -76,3 +81,3 @@ fast: options['fast'], | ||
} | ||
/* clean up compiled on each new init*/ | ||
@@ -109,3 +114,3 @@ rimraf.sync(compiler.getCompiledDir()) | ||
var compiledPath = params.compiledPath | ||
function writeCompiled(code) { | ||
function writeCompiled(code, filename) { | ||
fs.writeFileSync(compiledPath, code) | ||
@@ -124,3 +129,3 @@ fs.writeFileSync(compiledPath + '.done', '') | ||
} catch (e) { | ||
console.error(e) | ||
console.error('Compilation error:', e) | ||
code = 'throw new Error("Unable to compile TypeScript");' | ||
@@ -127,0 +132,0 @@ writeCompiled(code) |
{ | ||
"name": "ts-node-dev", | ||
"version": "1.0.0-pre.4", | ||
"version": "1.0.0-pre.5", | ||
"description": "Compiles your TS app and restarts when files are modified.", | ||
@@ -35,4 +35,4 @@ "keywords": [ | ||
"scripts": { | ||
"test1": "tap test/*.js", | ||
"ts-test": "node ./bin/ts-node-dev -r ./test/ts/add-require.js --respawn --ignore-watch lib --ignore-watch bin --prefer-ts --cache-directory .ts-node test/ts/test-script test-arg --fd" | ||
"test-node-dev": "tap test/*.js", | ||
"test": "node ./bin/ts-node-dev -r ./test/ts/add-require.js --respawn --ignore-watch lib --ignore-watch bin --prefer-ts --cache-directory .ts-node test/ts/test-script test-arg --fd" | ||
}, | ||
@@ -39,0 +39,0 @@ "dependencies": { |
26274
1.4%594
1.19%