From abcb13bb9cf95496efc3b29fc86aa4da5d66ae1e Mon Sep 17 00:00:00 2001 From: Omer Davutoglu <42009880+3mard@users.noreply.github.com> Date: Mon, 21 Jan 2019 23:56:08 +0100 Subject: [PATCH] Remove unused code (#751) --- package-lock.json | 13 +++---------- package.json | 2 -- src/index.ts | 22 +--------------------- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73f73f28e..ddadc4a0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,15 +28,6 @@ "integrity": "sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=", "dev": true }, - "@types/mkdirp": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz", - "integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/mocha": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.0.0.tgz", @@ -749,6 +740,7 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, "requires": { "minimist": "0.0.8" }, @@ -756,7 +748,8 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true } } }, diff --git a/package.json b/package.json index 9585ceca3..1170385e6 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "@types/chai": "^4.0.4", "@types/diff": "^3.2.1", "@types/minimist": "^1.2.0", - "@types/mkdirp": "^0.5.0", "@types/mocha": "^5.0.0", "@types/node": "^10.0.3", "@types/proxyquire": "^1.3.28", @@ -79,7 +78,6 @@ "diff": "^3.1.0", "make-error": "^1.1.1", "minimist": "^1.2.0", - "mkdirp": "^0.5.1", "source-map-support": "^0.5.6", "yn": "^2.0.0" } diff --git a/src/index.ts b/src/index.ts index b72e65321..90af40d9f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,6 @@ import { relative, basename, extname, resolve, dirname, join } from 'path' -import { readFileSync, writeFileSync } from 'fs' -import { EOL, tmpdir, homedir } from 'os' +import { EOL } from 'os' import sourceMapSupport = require('source-map-support') -import mkdirp = require('mkdirp') -import crypto = require('crypto') import yn = require('yn') import arrify = require('arrify') import { BaseError } from 'make-error' @@ -150,15 +147,6 @@ export interface Register { getTypeInfo (code: string, fileName: string, position: number): TypeInfo } -/** - * Return a default temp directory based on home directory of user. - */ -function getTmpDir (): string { - const hash = crypto.createHash('sha256').update(homedir(), 'utf8').digest('hex') - - return join(tmpdir(), `ts-node-${hash}`) -} - /** * Register TypeScript compiler. */ @@ -193,7 +181,6 @@ export function register (opts: Options = {}): Register { // Require the TypeScript compiler and configuration. const cwd = process.cwd() const { compilerOptions, project, skipProject } = options - const compiler = options.compiler || 'typescript' const typeCheck = options.typeCheck === true || options.transpileOnly !== true const transformers = options.transformers || undefined const readFile = options.readFile || ts.sys.readFile @@ -504,13 +491,6 @@ function updateSourceMap (sourceMapText: string, fileName: string) { return JSON.stringify(sourceMap) } -/** - * Create a hash of the current configuration. - */ -function getCompilerDigest (obj: object) { - return crypto.createHash('sha256').update(JSON.stringify(obj), 'utf8').digest('hex') -} - /** * Filter diagnostics. */