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AM,GAAG,cAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;IAEvH,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,gBAAgB,CAAA;AACjE,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAE,aAAqB,EAAE,QAAgB;IAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3C,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAA;IACzB,SAAS,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC9B,OAAO,SAAS,CAAC,UAAU,CAAA;IAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;AAClC,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAE,WAA6B,EAAE,MAAgB;IACzE,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import { relative, basename, extname, resolve, dirname, join } from 'path'\nimport sourceMapSupport = require('source-map-support')\nimport yn from 'yn'\nimport { BaseError } from 'make-error'\nimport * as util from 'util'\nimport * as _ts from 'typescript'\n\n/**\n * @internal\n */\nexport const INSPECT_CUSTOM = util.inspect.custom || 'inspect'\n\n/**\n * Debugging `ts-node`.\n */\nconst shouldDebug = yn(process.env.TS_NODE_DEBUG)\nconst debug = shouldDebug ? console.log.bind(console, 'ts-node') : () => undefined\nconst debugFn = shouldDebug ?\n <T, U> (key: string, fn: (arg: T) => U) => {\n let i = 0\n return (x: T) => {\n debug(key, x, ++i)\n return fn(x)\n }\n } :\n <T, U> (_: string, fn: (arg: T) => U) => fn\n\n/**\n * Common TypeScript interfaces between versions.\n */\nexport interface TSCommon {\n version: typeof _ts.version\n sys: typeof _ts.sys\n ScriptSnapshot: typeof _ts.ScriptSnapshot\n displayPartsToString: typeof _ts.displayPartsToString\n createLanguageService: typeof _ts.createLanguageService\n getDefaultLibFilePath: typeof _ts.getDefaultLibFilePath\n getPreEmitDiagnostics: typeof _ts.getPreEmitDiagnostics\n flattenDiagnosticMessageText: typeof _ts.flattenDiagnosticMessageText\n transpileModule: typeof _ts.transpileModule\n ModuleKind: typeof _ts.ModuleKind\n ScriptTarget: typeof _ts.ScriptTarget\n findConfigFile: typeof _ts.findConfigFile\n readConfigFile: typeof _ts.readConfigFile\n parseJsonConfigFileContent: typeof _ts.parseJsonConfigFileContent\n formatDiagnostics: typeof _ts.formatDiagnostics\n formatDiagnosticsWithColorAndContext: typeof _ts.formatDiagnosticsWithColorAndContext\n}\n\n/**\n * Export the current version.\n */\nexport const VERSION = require('../package.json').version\n\n/**\n * Registration options.\n */\nexport interface Options {\n pretty?: boolean | null\n typeCheck?: boolean | null\n transpileOnly?: boolean | null\n logError?: boolean | null\n files?: boolean | null\n compiler?: string\n ignore?: string[]\n project?: string\n skipIgnore?: boolean | null\n skipProject?: boolean | null\n preferTsExts?: boolean | null\n compilerOptions?: object\n ignoreDiagnostics?: Array<number | string>\n readFile?: (path: string) => string | undefined\n fileExists?: (path: string) => boolean\n transformers?: _ts.CustomTransformers | ((p: _ts.Program) => _ts.CustomTransformers)\n}\n\n/**\n * Track the project information.\n */\nclass MemoryCache {\n fileContents = new Map<string, string>()\n fileVersions = new Map<string, number>()\n\n constructor (public rootFileNames: string[] = []) {\n for (const fileName of rootFileNames) this.fileVersions.set(fileName, 1)\n }\n}\n\n/**\n * Information retrieved from type info check.\n */\nexport interface TypeInfo {\n name: string\n comment: string\n}\n\n/**\n * Default register options.\n */\nexport const DEFAULTS: Options = {\n files: yn(process.env['TS_NODE_FILES']),\n pretty: yn(process.env['TS_NODE_PRETTY']),\n compiler: process.env['TS_NODE_COMPILER'],\n compilerOptions: parse(process.env['TS_NODE_COMPILER_OPTIONS']),\n ignore: split(process.env['TS_NODE_IGNORE']),\n project: process.env['TS_NODE_PROJECT'],\n skipIgnore: yn(process.env['TS_NODE_SKIP_IGNORE']),\n skipProject: yn(process.env['TS_NODE_SKIP_PROJECT']),\n preferTsExts: yn(process.env['TS_NODE_PREFER_TS_EXTS']),\n ignoreDiagnostics: split(process.env['TS_NODE_IGNORE_DIAGNOSTICS']),\n typeCheck: yn(process.env['TS_NODE_TYPE_CHECK']),\n transpileOnly: yn(process.env['TS_NODE_TRANSPILE_ONLY']),\n logError: yn(process.env['TS_NODE_LOG_ERROR'])\n}\n\n/**\n * Default TypeScript compiler options required by `ts-node`.\n */\nconst TS_NODE_COMPILER_OPTIONS = {\n sourceMap: true,\n inlineSourceMap: false,\n inlineSources: true,\n declaration: false,\n noEmit: false,\n outDir: '$$ts-node$$'\n}\n\n/**\n * Split a string array of values.\n */\nexport function split (value: string | undefined) {\n return typeof value === 'string' ? value.split(/ *, */g) : undefined\n}\n\n/**\n * Parse a string as JSON.\n */\nexport function parse (value: string | undefined): object | undefined {\n return typeof value === 'string' ? JSON.parse(value) : undefined\n}\n\n/**\n * Replace backslashes with forward slashes.\n */\nexport function normalizeSlashes (value: string): string {\n return value.replace(/\\\\/g, '/')\n}\n\n/**\n * TypeScript diagnostics error.\n */\nexport class TSError extends BaseError {\n name = 'TSError'\n\n constructor (public diagnosticText: string, public diagnosticCodes: number[]) {\n super(`⨯ Unable to compile TypeScript:\\n${diagnosticText}`)\n }\n\n /**\n * @internal\n */\n [INSPECT_CUSTOM] () {\n return this.diagnosticText\n }\n}\n\n/**\n * Return type for registering `ts-node`.\n */\nexport interface Register {\n cwd: string\n extensions: string[]\n ts: TSCommon\n compile (code: string, fileName: string, lineOffset?: number): string\n getTypeInfo (code: string, fileName: string, position: number): TypeInfo\n}\n\n/**\n * Cached fs operation wrapper.\n */\nfunction cachedLookup <T> (fn: (arg: string) => T): (arg: string) => T {\n const cache = new Map<string, T>()\n\n return (arg: string): T => {\n if (!cache.has(arg)) {\n cache.set(arg, fn(arg))\n }\n\n return cache.get(arg)!\n }\n}\n\n/**\n * Register TypeScript compiler.\n */\nexport function register (opts: Options = {}): Register {\n const options = Object.assign({}, DEFAULTS, opts)\n const originalJsHandler = require.extensions['.js'] // tslint:disable-line\n\n const ignoreDiagnostics = [\n 6059, // \"'rootDir' is expected to contain all source files.\"\n 18002, // \"The 'files' list in config file is empty.\"\n 18003, // \"No inputs were found in config file.\"\n ...(options.ignoreDiagnostics || [])\n ].map(Number)\n\n const ignore = options.skipIgnore ? [] : (\n options.ignore || ['/node_modules/']\n ).map(str => new RegExp(str))\n\n // Require the TypeScript compiler and configuration.\n const cwd = process.cwd()\n const typeCheck = options.typeCheck === true || options.transpileOnly !== true\n const compiler = require.resolve(options.compiler || 'typescript', { paths: [cwd, __dirname] })\n const ts: typeof _ts = require(compiler)\n const transformers = options.transformers || undefined\n const readFile = options.readFile || ts.sys.readFile\n const fileExists = options.fileExists || ts.sys.fileExists\n const config = readConfig(cwd, ts, fileExists, readFile, options)\n const configDiagnosticList = filterDiagnostics(config.errors, ignoreDiagnostics)\n const extensions = ['.ts']\n const outputCache = new Map<string, string>()\n\n const diagnosticHost: _ts.FormatDiagnosticsHost = {\n getNewLine: () => ts.sys.newLine,\n getCurrentDirectory: () => cwd,\n getCanonicalFileName: (path) => path\n }\n\n // Install source map support and read from memory cache.\n sourceMapSupport.install({\n environment: 'node',\n retrieveFile (path: string) {\n return outputCache.get(path) || ''\n }\n })\n\n const formatDiagnostics = process.stdout.isTTY || options.pretty\n ? ts.formatDiagnosticsWithColorAndContext\n : ts.formatDiagnostics\n\n function createTSError (diagnostics: ReadonlyArray<_ts.Diagnostic>) {\n const diagnosticText = formatDiagnostics(diagnostics, diagnosticHost)\n const diagnosticCodes = diagnostics.map(x => x.code)\n return new TSError(diagnosticText, diagnosticCodes)\n }\n\n function reportTSError (configDiagnosticList: _ts.Diagnostic[]) {\n const error = createTSError(configDiagnosticList)\n if (options.logError) {\n // Print error in red color and continue execution.\n console.error('\\x1b[31m%s\\x1b[0m', error)\n } else {\n // Throw error and exit the script.\n throw error\n }\n }\n\n // Render the configuration errors.\n if (configDiagnosticList.length) reportTSError(configDiagnosticList)\n\n // Enable additional extensions when JSX or `allowJs` is enabled.\n if (config.options.jsx) extensions.push('.tsx')\n if (config.options.allowJs) extensions.push('.js')\n if (config.options.jsx && config.options.allowJs) extensions.push('.jsx')\n\n /**\n * Get the extension for a transpiled file.\n */\n const getExtension = config.options.jsx === ts.JsxEmit.Preserve ?\n ((path: string) => /\\.[tj]sx$/.test(path) ? '.jsx' : '.js') :\n ((_: string) => '.js')\n\n /**\n * Create the basic required function using transpile mode.\n */\n let getOutput: (code: string, fileName: string, lineOffset: number) => SourceOutput\n let getTypeInfo: (_code: string, _fileName: string, _position: number) => TypeInfo\n\n // Use full language services when the fast option is disabled.\n if (typeCheck) {\n const memoryCache = new MemoryCache(config.fileNames)\n const cachedReadFile = cachedLookup(debugFn('readFile', readFile))\n\n const getCustomTransformers = () => {\n if (typeof transformers === 'function') {\n const program = service.getProgram()\n return program ? transformers(program) : undefined\n }\n\n return transformers\n }\n\n // Create the compiler host for type checking.\n const serviceHost: _ts.LanguageServiceHost = {\n getScriptFileNames: () => memoryCache.rootFileNames,\n getScriptVersion: (fileName: string) => {\n const version = memoryCache.fileVersions.get(fileName)\n return version === undefined ? '' : version.toString()\n },\n getScriptSnapshot (fileName: string) {\n let contents = memoryCache.fileContents.get(fileName)\n\n // Read contents into TypeScript memory cache.\n if (contents === undefined) {\n contents = cachedReadFile(fileName)\n if (contents === undefined) return\n\n memoryCache.fileVersions.set(fileName, 1)\n memoryCache.fileContents.set(fileName, contents)\n }\n\n return ts.ScriptSnapshot.fromString(contents)\n },\n readFile: cachedReadFile,\n readDirectory: cachedLookup(debugFn('readDirectory', ts.sys.readDirectory)),\n getDirectories: cachedLookup(debugFn('getDirectories', ts.sys.getDirectories)),\n fileExists: cachedLookup(debugFn('fileExists', fileExists)),\n directoryExists: cachedLookup(debugFn('directoryExists', ts.sys.directoryExists)),\n getNewLine: () => ts.sys.newLine,\n useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,\n getCurrentDirectory: () => cwd,\n getCompilationSettings: () => config.options,\n getDefaultLibFileName: () => ts.getDefaultLibFilePath(config.options),\n getCustomTransformers: getCustomTransformers,\n writeFile: ts.sys.writeFile\n }\n\n const registry = ts.createDocumentRegistry(ts.sys.useCaseSensitiveFileNames, cwd)\n const service = ts.createLanguageService(serviceHost, registry)\n\n // Set the file contents into cache manually.\n const updateMemoryCache = (contents: string, fileName: string) => {\n const fileVersion = memoryCache.fileVersions.get(fileName) || 0\n\n // Add to `rootFiles` when discovered for the first time.\n if (fileVersion === 0) memoryCache.rootFileNames.push(fileName)\n\n // Avoid incrementing cache when nothing has changed.\n if (memoryCache.fileContents.get(fileName) === contents) return\n\n memoryCache.fileVersions.set(fileName, fileVersion + 1)\n memoryCache.fileContents.set(fileName, contents)\n }\n\n getOutput = (code: string, fileName: string) => {\n updateMemoryCache(code, fileName)\n\n const output = service.getEmitOutput(fileName)\n\n // Get the relevant diagnostics - this is 3x faster than `getPreEmitDiagnostics`.\n const diagnostics = service.getSemanticDiagnostics(fileName)\n .concat(service.getSyntacticDiagnostics(fileName))\n\n const diagnosticList = filterDiagnostics(diagnostics, ignoreDiagnostics)\n\n if (diagnosticList.length) reportTSError(diagnosticList)\n\n if (output.emitSkipped) {\n throw new TypeError(`${relative(cwd, fileName)}: Emit skipped`)\n }\n\n // Throw an error when requiring `.d.ts` files.\n if (output.outputFiles.length === 0) {\n throw new TypeError(\n 'Unable to require `.d.ts` file.\\n' +\n 'This is usually the result of a faulty configuration or import. ' +\n 'Make sure there is a `.js`, `.json` or another executable extension and ' +\n 'loader (attached before `ts-node`) available alongside ' +\n `\\`${basename(fileName)}\\`.`\n )\n }\n\n return [output.outputFiles[1].text, output.outputFiles[0].text]\n }\n\n getTypeInfo = (code: string, fileName: string, position: number) => {\n updateMemoryCache(code, fileName)\n\n const info = service.getQuickInfoAtPosition(fileName, position)\n const name = ts.displayPartsToString(info ? info.displayParts : [])\n const comment = ts.displayPartsToString(info ? info.documentation : [])\n\n return { name, comment }\n }\n } else {\n if (typeof transformers === 'function') {\n throw new TypeError('Transformers function is unavailable in \"--transpile-only\"')\n }\n\n getOutput = (code: string, fileName: string): SourceOutput => {\n const result = ts.transpileModule(code, {\n fileName,\n transformers,\n compilerOptions: config.options,\n reportDiagnostics: true\n })\n\n const diagnosticList = result.diagnostics ?\n filterDiagnostics(result.diagnostics, ignoreDiagnostics) :\n []\n\n if (diagnosticList.length) reportTSError(configDiagnosticList)\n\n return [result.outputText, result.sourceMapText as string]\n }\n\n getTypeInfo = () => {\n throw new TypeError('Type information is unavailable in \"--transpile-only\"')\n }\n }\n\n // Create a simple TypeScript compiler proxy.\n function compile (code: string, fileName: string, lineOffset = 0) {\n const [value, sourceMap] = getOutput(code, fileName, lineOffset)\n const output = updateOutput(value, fileName, sourceMap, getExtension)\n outputCache.set(fileName, output)\n return output\n }\n\n const register: Register = { cwd, compile, getTypeInfo, extensions, ts }\n\n // Register the extensions.\n registerExtensions(options.preferTsExts, extensions, ignore, register, originalJsHandler)\n\n return register\n}\n\n/**\n * Check if the filename should be ignored.\n */\nfunction shouldIgnore (filename: string, ignore: RegExp[]) {\n const relname = normalizeSlashes(filename)\n\n return ignore.some(x => x.test(relname))\n}\n\n/**\n * \"Refreshes\" an extension on `require.extentions`.\n *\n * @param {string} ext\n */\nfunction reorderRequireExtension (ext: string) {\n const old = require.extensions[ext] // tslint:disable-line\n delete require.extensions[ext] // tslint:disable-line\n require.extensions[ext] = old // tslint:disable-line\n}\n\n/**\n * Register the extensions to support when importing files.\n */\nfunction registerExtensions (\n preferTsExts: boolean | null | undefined,\n extensions: string[],\n ignore: RegExp[],\n register: Register,\n originalJsHandler: (m: NodeModule, filename: string) => any\n) {\n // Register new extensions.\n for (const ext of extensions) {\n registerExtension(ext, ignore, register, originalJsHandler)\n }\n\n if (preferTsExts) {\n // tslint:disable-next-line\n const preferredExtensions = new Set([...extensions, ...Object.keys(require.extensions)])\n\n for (const ext of preferredExtensions) reorderRequireExtension(ext)\n }\n}\n\n/**\n * Register the extension for node.\n */\nfunction registerExtension (\n ext: string,\n ignore: RegExp[],\n register: Register,\n originalHandler: (m: NodeModule, filename: string) => any\n) {\n const old = require.extensions[ext] || originalHandler // tslint:disable-line\n\n require.extensions[ext] = function (m: any, filename) { // tslint:disable-line\n if (shouldIgnore(filename, ignore)) {\n return old(m, filename)\n }\n\n const _compile = m._compile\n\n m._compile = function (code: string, fileName: string) {\n debug('module._compile', fileName)\n\n return _compile.call(this, register.compile(code, fileName), fileName)\n }\n\n return old(m, filename)\n }\n}\n\n/**\n * Do post-processing on config options to support `ts-node`.\n */\nfunction fixConfig (ts: TSCommon, config: _ts.ParsedCommandLine) {\n // Delete options that *should not* be passed through.\n delete config.options.out\n delete config.options.outFile\n delete config.options.composite\n delete config.options.declarationDir\n delete config.options.declarationMap\n delete config.options.emitDeclarationOnly\n delete config.options.tsBuildInfoFile\n delete config.options.incremental\n\n // Target ES5 output by default (instead of ES3).\n if (config.options.target === undefined) {\n config.options.target = ts.ScriptTarget.ES5\n }\n\n // Target CommonJS modules by default (instead of magically switching to ES6 when the target is ES6).\n if (config.options.module === undefined) {\n config.options.module = ts.ModuleKind.CommonJS\n }\n\n return config\n}\n\n/**\n * Load TypeScript configuration.\n */\nfunction readConfig (\n cwd: string,\n ts: TSCommon,\n fileExists: (path: string) => boolean,\n readFile: (path: string) => string | undefined,\n options: Options\n): _ts.ParsedCommandLine {\n let config: any = { compilerOptions: {} }\n let basePath = normalizeSlashes(cwd)\n let configFileName: string | undefined = undefined\n\n // Read project configuration when available.\n if (!options.skipProject) {\n configFileName = options.project\n ? normalizeSlashes(resolve(cwd, options.project))\n : ts.findConfigFile(normalizeSlashes(cwd), fileExists)\n\n if (configFileName) {\n const result = ts.readConfigFile(configFileName, readFile)\n\n // Return diagnostics.\n if (result.error) {\n return { errors: [result.error], fileNames: [], options: {} }\n }\n\n config = result.config\n basePath = normalizeSlashes(dirname(configFileName))\n }\n }\n\n // Remove resolution of \"files\".\n if (!options.files) {\n config.files = []\n config.include = []\n }\n\n // Override default configuration options `ts-node` requires.\n config.compilerOptions = Object.assign({}, config.compilerOptions, options.compilerOptions, TS_NODE_COMPILER_OPTIONS)\n\n return fixConfig(ts, ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName))\n}\n\n/**\n * Internal source output.\n */\ntype SourceOutput = [string, string]\n\n/**\n * Update the output remapping the source map.\n */\nfunction updateOutput (outputText: string, fileName: string, sourceMap: string, getExtension: (fileName: string) => string) {\n const base64Map = Buffer.from(updateSourceMap(sourceMap, fileName), 'utf8').toString('base64')\n const sourceMapContent = `data:application/json;charset=utf-8;base64,${base64Map}`\n const sourceMapLength = `${basename(fileName)}.map`.length + (getExtension(fileName).length - extname(fileName).length)\n\n return outputText.slice(0, -sourceMapLength) + sourceMapContent\n}\n\n/**\n * Update the source map contents for improved output.\n */\nfunction updateSourceMap (sourceMapText: string, fileName: string) {\n const sourceMap = JSON.parse(sourceMapText)\n sourceMap.file = fileName\n sourceMap.sources = [fileName]\n delete sourceMap.sourceRoot\n return JSON.stringify(sourceMap)\n}\n\n/**\n * Filter diagnostics.\n */\nfunction filterDiagnostics (diagnostics: _ts.Diagnostic[], ignore: number[]) {\n return diagnostics.filter(x => ignore.indexOf(x.code) === -1)\n}\n"]} |