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AK,CAAC,CAAA;IAC/B,KAAK,CAAC,OAAO,EAAE,CAAA;IAEf,OAAO;QACL,KAAK,CAAC,KAAK,GAAG,SAAS,CAAA;QACvB,KAAK,CAAC,MAAM,GAAG,UAAU,CAAA;QACzB,KAAK,CAAC,OAAO,GAAG,WAAW,CAAA;QAC3B,KAAK,CAAC,KAAK,GAAG,SAAS,CAAA;IACzB,CAAC,CAAA;AACH,CAAC;AAED;;GAEG;AACH,SAAS,SAAS,CAAE,KAAa;IAC/B,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,KAAK,EAAE,CAAA;SACR;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,cAAc,GAAgB,IAAI,GAAG,CAAC;IAC1C,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI,CAAC,oFAAoF;CAC1F,CAAC,CAAA;AAEF;;GAEG;AACH,SAAS,aAAa,CAAE,KAAc;IACpC,OAAO,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;AACtE,CAAC;AAED,4BAA4B;AAC5B,SAAS,cAAc,CAAE,MAAW,EAAE,QAAgB;IACpD,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC/D,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5B","sourcesContent":["#!/usr/bin/env node\n\nimport { join, resolve, dirname } from 'path'\nimport { start, Recoverable } from 'repl'\nimport { inspect } from 'util'\nimport Module = require('module')\nimport arg = require('arg')\nimport { diffLines } from 'diff'\nimport { Script } from 'vm'\nimport { readFileSync, statSync, realpathSync } from 'fs'\nimport { homedir } from 'os'\nimport { VERSION, TSError, parse, Register, register } from './index'\n\n/**\n * Eval filename for REPL/debug.\n */\nconst EVAL_FILENAME = `[eval].ts`\n\n/**\n * Eval state management.\n */\nclass EvalState {\n input = ''\n output = ''\n version = 0\n lines = 0\n\n constructor (public path: string) {}\n}\n\n/**\n * Main `bin` functionality.\n */\nexport function main (argv: string[]) {\n const args = arg({\n // Node.js-like options.\n '--eval': String,\n '--interactive': Boolean,\n '--print': Boolean,\n '--require': [String],\n\n // CLI options.\n '--help': Boolean,\n '--script-mode': Boolean,\n '--version': arg.COUNT,\n\n // Project options.\n '--dir': String,\n '--files': Boolean,\n '--compiler': String,\n '--compiler-options': parse,\n '--project': String,\n '--ignore-diagnostics': [String],\n '--ignore': [String],\n '--transpile-only': Boolean,\n '--type-check': Boolean,\n '--compiler-host': Boolean,\n '--pretty': Boolean,\n '--skip-project': Boolean,\n '--skip-ignore': Boolean,\n '--prefer-ts-exts': Boolean,\n '--log-error': Boolean,\n '--emit': Boolean,\n\n // Aliases.\n '-e': '--eval',\n '-i': '--interactive',\n '-p': '--print',\n '-r': '--require',\n '-h': '--help',\n '-s': '--script-mode',\n '-v': '--version',\n '-T': '--transpile-only',\n '-H': '--compiler-host',\n '-I': '--ignore',\n '-P': '--project',\n '-C': '--compiler',\n '-D': '--ignore-diagnostics',\n '-O': '--compiler-options'\n }, {\n argv,\n stopAtPositional: true\n })\n\n // Only setting defaults for CLI-specific flags\n // Anything passed to `register()` can be `undefined`; `create()` will apply\n // defaults.\n const {\n '--dir': dir,\n '--help': help = false,\n '--script-mode': scriptMode = false,\n '--version': version = 0,\n '--require': requires = [],\n '--eval': code = undefined,\n '--print': print = false,\n '--interactive': interactive = false,\n '--files': files,\n '--compiler': compiler,\n '--compiler-options': compilerOptions,\n '--project': project,\n '--ignore-diagnostics': ignoreDiagnostics,\n '--ignore': ignore,\n '--transpile-only': transpileOnly,\n '--type-check': typeCheck,\n '--compiler-host': compilerHost,\n '--pretty': pretty,\n '--skip-project': skipProject,\n '--skip-ignore': skipIgnore,\n '--prefer-ts-exts': preferTsExts,\n '--log-error': logError,\n '--emit': emit\n } = args\n\n if (help) {\n console.log(`\n Usage: ts-node [options] [ -e script | script.ts ] [arguments]\n\n Options:\n\n -e, --eval [code] Evaluate code\n -p, --print Print result of \\`--eval\\`\n -r, --require [path] Require a node module before execution\n -i, --interactive Opens the REPL even if stdin does not appear to be a terminal\n\n -h, --help Print CLI usage\n -v, --version Print module version information\n -s, --script-mode Use cwd from <script.ts> instead of current directory\n\n -T, --transpile-only Use TypeScript's faster \\`transpileModule\\`\n -H, --compiler-host Use TypeScript's compiler host API\n -I, --ignore [pattern] Override the path patterns to skip compilation\n -P, --project [path] Path to TypeScript JSON project file\n -C, --compiler [name] Specify a custom TypeScript compiler\n -D, --ignore-diagnostics [code] Ignore TypeScript warnings by diagnostic code\n -O, --compiler-options [opts] JSON object to merge with compiler options\n\n --dir Specify working directory for config resolution\n --scope Scope compiler to files within \\`cwd\\` only\n --files Load \\`files\\`, \\`include\\` and \\`exclude\\` from \\`tsconfig.json\\` on startup\n --pretty Use pretty diagnostic formatter (usually enabled by default)\n --skip-project Skip reading \\`tsconfig.json\\`\n --skip-ignore Skip \\`--ignore\\` checks\n --prefer-ts-exts Prefer importing TypeScript files over JavaScript files\n --log-error Logs TypeScript errors to stderr instead of throwing exceptions\n `)\n\n process.exit(0)\n }\n\n // Output project information.\n if (version === 1) {\n console.log(`v${VERSION}`)\n process.exit(0)\n }\n\n const cwd = dir || process.cwd()\n /** Unresolved. May point to a symlink, not realpath. May be missing file extension */\n const scriptPath = args._.length ? resolve(cwd, args._[0]) : undefined\n const state = new EvalState(scriptPath || join(cwd, EVAL_FILENAME))\n\n // Register the TypeScript compiler instance.\n const service = register({\n dir: getCwd(dir, scriptMode, scriptPath),\n emit,\n files,\n pretty,\n transpileOnly,\n typeCheck,\n compilerHost,\n ignore,\n preferTsExts,\n logError,\n project,\n skipProject,\n skipIgnore,\n compiler,\n ignoreDiagnostics,\n compilerOptions,\n readFile: code !== undefined\n ? (path: string) => {\n if (path === state.path) return state.input\n\n try {\n return readFileSync(path, 'utf8')\n } catch (err) {/* Ignore. */}\n }\n : undefined,\n fileExists: code !== undefined\n ? (path: string) => {\n if (path === state.path) return true\n\n try {\n const stats = statSync(path)\n return stats.isFile() || stats.isFIFO()\n } catch (err) {\n return false\n }\n }\n : undefined\n })\n\n // Output project information.\n if (version >= 2) {\n console.log(`ts-node v${VERSION}`)\n console.log(`node ${process.version}`)\n console.log(`compiler v${service.ts.version}`)\n process.exit(0)\n }\n\n // Create a local module instance based on `cwd`.\n const module = new Module(state.path)\n module.filename = state.path\n module.paths = (Module as any)._nodeModulePaths(cwd)\n\n // Require specified modules before start-up.\n ;(Module as any)._preloadModules(requires)\n\n // Prepend `ts-node` arguments to CLI for child processes.\n process.execArgv.unshift(__filename, ...process.argv.slice(2, process.argv.length - args._.length))\n process.argv = [process.argv[1]].concat(scriptPath || []).concat(args._.slice(1))\n\n // Execute the main contents (either eval, script or piped).\n if (code !== undefined && !interactive) {\n evalAndExit(service, state, module, code, print)\n } else {\n if (args._.length) {\n Module.runMain()\n } else {\n // Piping of execution _only_ occurs when no other script is specified.\n // --interactive flag forces REPL\n if (interactive || process.stdin.isTTY) {\n startRepl(service, state, code)\n } else {\n let buffer = code || ''\n process.stdin.on('data', (chunk: Buffer) => buffer += chunk)\n process.stdin.on('end', () => evalAndExit(service, state, module, buffer, print))\n }\n }\n }\n}\n\n/**\n * Get project path from args.\n */\nfunction getCwd (dir?: string, scriptMode?: boolean, scriptPath?: string) {\n // Validate `--script-mode` usage is correct.\n if (scriptMode) {\n if (!scriptPath) {\n throw new TypeError('Script mode must be used with a script name, e.g. `ts-node -s <script.ts>`')\n }\n\n if (dir) {\n throw new TypeError('Script mode cannot be combined with `--dir`')\n }\n\n // Use node's own resolution behavior to ensure we follow symlinks.\n // scriptPath may omit file extension or point to a directory with or without package.json.\n // This happens before we are registered, so we tell node's resolver to consider ts, tsx, and jsx files.\n // In extremely rare cases, is is technically possible to resolve the wrong directory,\n // because we do not yet know preferTsExts, jsx, nor allowJs.\n // See also, justification why this will not happen in real-world situations:\n // https://github.com/TypeStrong/ts-node/pull/1009#issuecomment-613017081\n const exts = ['.js', '.jsx', '.ts', '.tsx']\n const extsTemporarilyInstalled: string[] = []\n for (const ext of exts) {\n if (!hasOwnProperty(require.extensions, ext)) { // tslint:disable-line\n extsTemporarilyInstalled.push(ext)\n require.extensions[ext] = function() {} // tslint:disable-line\n }\n }\n try {\n return dirname(require.resolve(scriptPath))\n } finally {\n for (const ext of extsTemporarilyInstalled) {\n delete require.extensions[ext] // tslint:disable-line\n }\n }\n }\n\n return dir\n}\n\n/**\n * Evaluate a script.\n */\nfunction evalAndExit (service: Register, state: EvalState, module: Module, code: string, isPrinted: boolean) {\n let result: any\n\n ;(global as any).__filename = module.filename\n ;(global as any).__dirname = dirname(module.filename)\n ;(global as any).exports = module.exports\n ;(global as any).module = module\n ;(global as any).require = module.require.bind(module)\n\n try {\n result = _eval(service, state, code)\n } catch (error) {\n if (error instanceof TSError) {\n console.error(error)\n process.exit(1)\n }\n\n throw error\n }\n\n if (isPrinted) {\n console.log(typeof result === 'string' ? result : inspect(result))\n }\n}\n\n/**\n * Evaluate the code snippet.\n */\nfunction _eval (service: Register, state: EvalState, input: string) {\n const lines = state.lines\n const isCompletion = !/\\n$/.test(input)\n const undo = appendEval(state, input)\n let output: string\n\n try {\n output = service.compile(state.input, state.path, -lines)\n } catch (err) {\n undo()\n throw err\n }\n\n // Use `diff` to check for new JavaScript to execute.\n const changes = diffLines(state.output, output)\n\n if (isCompletion) {\n undo()\n } else {\n state.output = output\n }\n\n return changes.reduce((result, change) => {\n return change.added ? exec(change.value, state.path) : result\n }, undefined)\n}\n\n/**\n * Execute some code.\n */\nfunction exec (code: string, filename: string) {\n const script = new Script(code, { filename: filename })\n\n return script.runInThisContext()\n}\n\n/**\n * Start a CLI REPL.\n */\nfunction startRepl (service: Register, state: EvalState, code?: string) {\n // Eval incoming code before the REPL starts.\n if (code) {\n try {\n _eval(service, state, `${code}\\n`)\n } catch (err) {\n console.error(err)\n process.exit(1)\n }\n }\n\n const repl = start({\n prompt: '> ',\n input: process.stdin,\n output: process.stdout,\n terminal: process.stdout.isTTY,\n eval: replEval,\n useGlobal: true\n })\n\n /**\n * Eval code from the REPL.\n */\n function replEval (code: string, _context: any, _filename: string, callback: (err: Error | null, result?: any) => any) {\n let err: Error | null = null\n let result: any\n\n // TODO: Figure out how to handle completion here.\n if (code === '.scope') {\n callback(err)\n return\n }\n\n try {\n result = _eval(service, state, code)\n } catch (error) {\n if (error instanceof TSError) {\n // Support recoverable compilations using >= node 6.\n if (Recoverable && isRecoverable(error)) {\n err = new Recoverable(error)\n } else {\n console.error(error)\n }\n } else {\n err = error\n }\n }\n\n return callback(err, result)\n }\n\n // Bookmark the point where we should reset the REPL state.\n const resetEval = appendEval(state, '')\n\n function reset () {\n resetEval()\n\n // Hard fix for TypeScript forcing `Object.defineProperty(exports, ...)`.\n exec('exports = module.exports', state.path)\n }\n\n reset()\n repl.on('reset', reset)\n\n repl.defineCommand('type', {\n help: 'Check the type of a TypeScript identifier',\n action: function (identifier: string) {\n if (!identifier) {\n repl.displayPrompt()\n return\n }\n\n const undo = appendEval(state, identifier)\n const { name, comment } = service.getTypeInfo(state.input, state.path, state.input.length)\n\n undo()\n\n if (name) repl.outputStream.write(`${name}\\n`)\n if (comment) repl.outputStream.write(`${comment}\\n`)\n repl.displayPrompt()\n }\n })\n\n // Set up REPL history when available natively via node.js >= 11.\n if (repl.setupHistory) {\n const historyPath = process.env.TS_NODE_HISTORY || join(homedir(), '.ts_node_repl_history')\n\n repl.setupHistory(historyPath, err => {\n if (!err) return\n\n console.error(err)\n process.exit(1)\n })\n }\n}\n\n/**\n * Append to the eval instance and return an undo function.\n */\nfunction appendEval (state: EvalState, input: string) {\n const undoInput = state.input\n const undoVersion = state.version\n const undoOutput = state.output\n const undoLines = state.lines\n\n // Handle ASI issues with TypeScript re-evaluation.\n if (undoInput.charAt(undoInput.length - 1) === '\\n' && /^\\s*[\\/\\[(`-]/.test(input) && !/;\\s*$/.test(undoInput)) {\n state.input = `${state.input.slice(0, -1)};\\n`\n }\n\n state.input += input\n state.lines += lineCount(input)\n state.version++\n\n return function () {\n state.input = undoInput\n state.output = undoOutput\n state.version = undoVersion\n state.lines = undoLines\n }\n}\n\n/**\n * Count the number of lines.\n */\nfunction lineCount (value: string) {\n let count = 0\n\n for (const char of value) {\n if (char === '\\n') {\n count++\n }\n }\n\n return count\n}\n\nconst RECOVERY_CODES: Set<number> = new Set([\n 1003, // \"Identifier expected.\"\n 1005, // \"')' expected.\"\n 1109, // \"Expression expected.\"\n 1126, // \"Unexpected end of text.\"\n 1160, // \"Unterminated template literal.\"\n 1161, // \"Unterminated regular expression literal.\"\n 2355 // \"A function whose declared type is neither 'void' nor 'any' must return a value.\"\n])\n\n/**\n * Check if a function can recover gracefully.\n */\nfunction isRecoverable (error: TSError) {\n return error.diagnosticCodes.every(code => RECOVERY_CODES.has(code))\n}\n\n/** Safe `hasOwnProperty` */\nfunction hasOwnProperty (object: any, property: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, property)\n}\n\nif (require.main === module) {\n main(process.argv.slice(2))\n}\n"]}