Comparing version 1.0.0 to 1.1.0
@@ -5,2 +5,4 @@ "use strict"; | ||
var util_1 = require('util'); | ||
var arrify = require('arrify'); | ||
var extend = require('xtend'); | ||
var Module = require('module'); | ||
@@ -12,3 +14,3 @@ var minimist = require('minimist'); | ||
var index_1 = require('./index'); | ||
var strings = ['eval', 'print', 'compiler', 'project', 'ignoreWarnings']; | ||
var strings = ['eval', 'print', 'compiler', 'project', 'ignoreWarnings', 'cacheDirectory']; | ||
var booleans = ['help', 'fast', 'lazy', 'version', 'disableWarnings', 'cache']; | ||
@@ -24,2 +26,3 @@ var aliases = { | ||
compiler: ['C'], | ||
cacheDirectory: ['cache-directory'], | ||
ignoreWarnings: ['I', 'ignore-warnings'], | ||
@@ -81,3 +84,3 @@ disableWarnings: ['D', 'disable-warnings'], | ||
if (argv.help) { | ||
console.log("\nUsage: ts-node [options] [ -e script | script.ts ] [arguments]\n\nOptions:\n\n -e, --eval [code] Evaluate code\n -p, --print [code] Evaluate code and print result\n -C, --compiler [name] Specify a custom TypeScript compiler\n -I, --ignoreWarnings [codes] Ignore TypeScript warnings by diagnostic code\n -D, --disableWarnings Ignore every TypeScript warning\n -P, --project [path] Path to TypeScript project (or `false`)\n -O, --compilerOptions [opts] JSON compiler options to merge with compilation\n -L, --lazy Lazily load TypeScript compilation\n -F, --fast Run TypeScript compilation in transpile mode\n --no-cache Disable the TypeScript cache\n"); | ||
console.log("\nUsage: ts-node [options] [ -e script | script.ts ] [arguments]\n\nOptions:\n\n -e, --eval [code] Evaluate code\n -p, --print [code] Evaluate code and print result\n -C, --compiler [name] Specify a custom TypeScript compiler\n -I, --ignoreWarnings [code] Ignore TypeScript warnings by diagnostic code\n -D, --disableWarnings Ignore every TypeScript warning\n -P, --project [path] Path to TypeScript project (or `false`)\n -O, --compilerOptions [opts] JSON compiler options to merge with compilation\n -L, --lazy Lazily load TypeScript compilation\n -F, --fast Run TypeScript compilation in transpile mode\n --no-cache Disable the TypeScript cache\n --cache-directory Configure the TypeScript cache directory\n"); | ||
process.exit(0); | ||
@@ -97,15 +100,8 @@ } | ||
var isPrinted = argv.print != null; | ||
var service = index_1.register({ | ||
var service = index_1.register(extend(argv, { | ||
getFile: isEval ? getFileEval : index_1.getFile, | ||
getVersion: isEval ? getVersionEval : index_1.getVersion, | ||
fileExists: isEval ? fileExistsEval : index_1.fileExists, | ||
fast: argv.fast, | ||
lazy: argv.lazy, | ||
cache: argv.cache, | ||
compiler: argv.compiler, | ||
ignoreWarnings: list(argv.ignoreWarnings), | ||
project: argv.project, | ||
disableWarnings: argv.disableWarnings, | ||
compilerOptions: argv.compilerOptions | ||
}); | ||
ignoreWarnings: arrify(argv.ignoreWarnings) | ||
})); | ||
var EVAL_FILENAME = '[eval].ts'; | ||
@@ -248,5 +244,2 @@ var EVAL_PATH = path_1.join(cwd, EVAL_FILENAME); | ||
} | ||
function list(value) { | ||
return String(value).split(/ *, */); | ||
} | ||
function getFileEval(fileName) { | ||
@@ -253,0 +246,0 @@ return fileName === EVAL_PATH ? evalFile.input : index_1.getFile(fileName); |
@@ -26,2 +26,3 @@ import { BaseError } from 'make-error'; | ||
cache?: boolean; | ||
cacheDirectory?: string; | ||
compiler?: string; | ||
@@ -48,2 +49,4 @@ project?: string; | ||
export declare function fileExists(fileName: string): boolean; | ||
export declare function getDirectories(path: string): string[]; | ||
export declare function directoryExists(path: string): boolean; | ||
export declare function getFile(fileName: string): string; | ||
@@ -50,0 +53,0 @@ export declare class TSError extends BaseError { |
@@ -16,3 +16,2 @@ "use strict"; | ||
var make_error_1 = require('make-error'); | ||
var TMP_DIR = path_1.join(os_1.tmpdir(), 'ts-node'); | ||
var pkg = require('../package.json'); | ||
@@ -26,2 +25,3 @@ var oldHandlers = {}; | ||
cache: process.env.TS_NODE_CACHE, | ||
cacheDirectory: process.env.TS_NODE_CACHE_DIRECTORY || path_1.join(os_1.tmpdir(), 'ts-node'), | ||
disableWarnings: process.env.TS_NODE_DISABLE_WARNINGS, | ||
@@ -58,3 +58,3 @@ compiler: process.env.TS_NODE_COMPILER, | ||
var configDiagnostics = formatDiagnostics(config.errors, options, cwd, ts); | ||
var cachedir = path_1.join(TMP_DIR, getCompilerDigest(ts, options, config)); | ||
var cachedir = path_1.join(path_1.resolve(cwd, options.cacheDirectory), getCompilerDigest(ts, options, config)); | ||
mkdirp.sync(cachedir); | ||
@@ -100,2 +100,4 @@ if (configDiagnostics.length) { | ||
}, | ||
getDirectories: getDirectories, | ||
directoryExists: directoryExists, | ||
getNewLine: function () { return os_1.EOL; }, | ||
@@ -292,2 +294,15 @@ getCurrentDirectory: function () { return cwd; }, | ||
exports.fileExists = fileExists; | ||
function getDirectories(path) { | ||
return fs_1.readdirSync(path).filter(function (name) { return directoryExists(path_1.join(path, name)); }); | ||
} | ||
exports.getDirectories = getDirectories; | ||
function directoryExists(path) { | ||
try { | ||
return fs_1.statSync(path).isDirectory(); | ||
} | ||
catch (err) { | ||
return false; | ||
} | ||
} | ||
exports.directoryExists = directoryExists; | ||
function getFile(fileName) { | ||
@@ -294,0 +309,0 @@ return fs_1.readFileSync(fileName, 'utf8'); |
{ | ||
"name": "ts-node", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"preferGlobal": true, | ||
@@ -56,3 +56,3 @@ "description": "TypeScript execution environment and REPL for node", | ||
"tslint-config-standard": "^1.0.0", | ||
"typescript": "1.8.7", | ||
"typescript": "^1.8.10", | ||
"typings": "^1.0.4" | ||
@@ -59,0 +59,0 @@ }, |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
99290
854
12