{"version":3,"file":"index.js","sources":["../src/tsCompile.ts","../src/compileUtil.ts","../src/loadTsConfig.ts"],"sourcesContent":["import * as ts from \"typescript\";\nimport { Program, EmitResult } from \"typescript\";\nimport path from \"path\";\n\nexport interface CompileResult {\n localSources: string[];\n compiled: boolean;\n}\n\nexport function tsCompile(\n fileNames: string[],\n options: ts.CompilerOptions\n): CompileResult {\n console.log(\"compiling:\", fileNames);\n const program = ts.createProgram(fileNames, options);\n const sources = program\n .getSourceFiles()\n .map((f) => f.fileName)\n .filter((name) => !name.includes(\"node_modules\"));\n const emitResult = program.emit();\n logDiagnostics(program, emitResult);\n\n return { localSources: sources, compiled: !emitResult.emitSkipped };\n}\n\nfunction logDiagnostics(program: Program, emitResult: EmitResult): void {\n const allDiagnostics = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics);\n\n allDiagnostics.forEach((diagnostic) => {\n if (diagnostic.file) {\n const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(\n diagnostic.start!\n );\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n \"\\n\"\n );\n\n const filePath = path.resolve(diagnostic.file.fileName);\n console.log(\n `tsc: (${filePath}:${line + 1}:${character + 1}): ${message}`\n );\n } else {\n console.log(\n ts.flattenDiagnosticMessageText(diagnostic.messageText, \"\\n\")\n );\n }\n });\n}\n","import { glob } from \"glob\";\nimport path from \"path\";\nimport { tsCompile } from \"./tsCompile\";\nimport ts from \"typescript\";\nimport fs from \"fs\";\n\nconst fsRoot = path.parse(process.cwd()).root;\n\n/** Return true if any files need compiling */\nexport function needsCompile(srcGlobs: string[], outDir: string): boolean {\n const files = srcGlobs.flatMap((src) => glob.sync(src));\n const srcDestPairs = compilationPairs(files, outDir);\n return anyOutDated(srcDestPairs);\n}\n\n/** Return true if all files exist on the filesystem */\nexport function expectFilesExist(files: string[]): boolean {\n const missing = files.find((file) => !fs.existsSync(file));\n if (missing) {\n return false;\n }\n return true;\n}\n\n/** @return path to the js file that will be produced by typescript compilation */\nexport function jsOutFile(tsFile: string, outDir: string): string {\n const tsAbsolutePath = path.resolve(tsFile);\n const tsAbsoluteDir = path.dirname(tsAbsolutePath);\n const dirFromRoot = path.relative(fsRoot, tsAbsoluteDir);\n const jsDir = path.join(outDir, dirFromRoot);\n const outFile = changeSuffix(path.basename(tsFile), \".js\");\n return path.join(jsDir, outFile);\n}\n\n// for tests\nexport let _compileCount = 0; \nexport function _withCompileCount(fn:() => void):number {\n _compileCount = 0;\n fn();\n return _compileCount;\n}\n\n\n/* \nWe set rootDir to fsRoot for tsc compilation.\n\nThat means that the .js output files produced by typescript will be in a deep tree\nof subdirectories mirroring the path from / to the source file. \n e.g. /home/lee/proj/foo.ts will output to outdir/home/proj/lee/foo.js.\n\nWe need to set a rootDir so that the output tree js files produced by typescript is\npredictable prior to compilation. Without a rootDir, tsc will make an output tree that\nis as short as possible depending on the imports used by the .ts files. Shorter is nice, \nbut the unpredictability breaks checks for on-demand compilation.\n\nA .ts file can import from parent directories.\n e.g. import * from \"../util\". \nSo we use the file system root as the rootDir to be conservative in handling\npotential parent directory imports.\n*/\n\n\nexport function compileIfNecessary(\n sources: string[],\n outDir: string,\n strict = true\n): boolean {\n const sourceSet = new Set([...sources, ...extendedSources(outDir)]);\n const allSources = [...sourceSet];\n if (needsCompile(allSources, outDir)) {\n _compileCount++;\n const { compiled, localSources } = tsCompile(sources, {\n outDir,\n rootDir: fsRoot,\n module: ts.ModuleKind.CommonJS,\n moduleResolution: ts.ModuleResolutionKind.NodeJs,\n esModuleInterop: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict,\n target: ts.ScriptTarget.ES2019,\n noImplicitAny: false,\n noEmitOnError: true,\n });\n if (compiled) {\n saveExtendedSources(outDir, localSources);\n linkNodeModules(outDir);\n }\n return compiled;\n }\n return true;\n}\n\n/** local sources used in last compilation, including imports */\nfunction extendedSources(outDir: string): string[] {\n const file = sourcesFile(outDir);\n if (!fs.existsSync(file)) {\n return [];\n }\n const lines = fs.readFileSync(file, \"utf8\");\n return lines.split(\"\\n\");\n}\n\nfunction sourcesFile(outDir: string): string {\n return path.join(outDir, \"_sources\");\n}\n\nfunction saveExtendedSources(outDir: string, allSources: string[]): void {\n const file = sourcesFile(outDir);\n fs.writeFileSync(file, allSources.join(\"\\n\"));\n}\n\n/** Put a link in the output directory to node_modules.\n */\nfunction linkNodeModules(outDir: string): void {\n /*\n * Note that this only puts a link to the single node_modules directory\n * that's closest by.\n *\n * But I think node's module resolution will search multiple\n * parent directories for multiple node_modules at runtime. So just one\n * node_modules link may be insufficient in some complicated cases.\n *\n * If supporting the more complicated case is worthwhile, we can consider\n * e.g. encoding a full list of node_modules and setting NODE_PATH instead\n * of the symlink approach here.\n */\n const nodeModules = nearestNodeModules(process.cwd());\n if (nodeModules) {\n const linkToModules = path.join(outDir, \"node_modules\");\n symLinkForce(nodeModules, linkToModules);\n }\n}\n\n/** create a symlink, replacing any existing linkfile */\nexport function symLinkForce(existing: string, link: string): void {\n if (fs.existsSync(link)) {\n if (!fs.lstatSync(link).isSymbolicLink()) {\n throw `symLinkForce refusing to unlink non-symlink ${link}`;\n }\n fs.unlinkSync(link);\n }\n fs.symlinkSync(existing, link);\n}\n\n/** @return the resolved path to the nearest node_modules file,\n * either in the provided directory or a parent.\n */\nexport function nearestNodeModules(dir: string): string | undefined {\n const resolvedDir = path.resolve(dir);\n const modulesFile = path.join(resolvedDir, \"node_modules\");\n\n if (fs.existsSync(modulesFile)) {\n return modulesFile;\n } else {\n const { dir: parent, root } = path.parse(resolvedDir);\n if (parent !== root) {\n return nearestNodeModules(parent);\n } else {\n return undefined;\n }\n }\n}\n\n/**\n * Compile a typescript config file to js if necessary (if the js\n * file doesn't exist or is older than the typescript file).\n *\n * @param tsFile path to ts config file\n * @param outDir directory to place the compiled js file\n * @returns the path to the compiled javascript config file,\n * or undefined if the compilation fails.\n */\nexport function compileConfigIfNecessary(\n tsFile: string,\n outDir: string,\n strict = true\n): string | undefined {\n if (!fs.existsSync(tsFile)) {\n console.error(\"config file:\", tsFile, \" not found\");\n return undefined;\n }\n\n const success = compileIfNecessary([tsFile], outDir, strict);\n if (!success) {\n return undefined;\n }\n\n return jsOutFile(tsFile, outDir);\n}\n\nfunction compilationPairs(\n srcFiles: string[],\n outDir: string\n): [string, string][] {\n return srcFiles.map((tsFile) => {\n return [tsFile, jsOutFile(tsFile, outDir)];\n });\n}\n\nfunction anyOutDated(filePairs: [string, string][]): boolean {\n const found = filePairs.find(([srcPath, outPath]) => {\n if (!fs.existsSync(outPath)) {\n return true;\n }\n const srcTime = fs.statSync(srcPath).mtime;\n const outTime = fs.statSync(outPath).mtime;\n return srcTime > outTime;\n });\n\n return found !== undefined;\n}\n\nfunction changeSuffix(filePath: string, suffix: string): string {\n const dir = path.dirname(filePath);\n const curSuffix = path.extname(filePath);\n const base = path.basename(filePath, curSuffix);\n return path.join(dir, base + suffix);\n}\n","import { compileConfigIfNecessary } from \"./compileUtil\";\nimport os, { platform } from \"os\";\nimport path from \"path\";\n\n/** Load a typescript configuration file.\n * For speed, the typescript file is transpiled to javascript and cached.\n *\n * @param T type of default export value in the configuration file\n * @param outDir location to store the compiled javascript. \n * Defaults to $HOME/.cache/config-file-ts//\n * @returns the default exported value from the configuration file or undefined\n */\nexport function loadTsConfig(\n tsFile: string,\n outDir?: string | undefined,\n strict = true\n): T | undefined {\n const realOutDir = outDir || defaultOutDir(tsFile);\n const jsConfig = compileConfigIfNecessary(tsFile, realOutDir, strict);\n if (!jsConfig) {\n return undefined;\n }\n\n const end = jsConfig.length - path.extname(jsConfig).length;\n const requirePath = jsConfig.slice(0, end);\n const config = require(requirePath);\n return config.default;\n}\n\n/** @return the directory that will be used to store transpilation output. */\nexport function defaultOutDir(\n tsFile: string,\n programName: string = \"config-file-ts\"\n): string {\n const tsPath = path.resolve(tsFile);\n let smushedPath = tsPath\n .split(path.sep)\n .join(\"-\")\n .slice(1);\n if (platform() === \"win32\") {\n smushedPath = smushedPath.replace(/^:/, \"\");\n }\n return path.join(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