* Iterates over the source files that are expected to have an emit output. * * @param host An EmitHost. * @param action The action to execute. * @param sourceFilesOrTargetSourceFile * If an array, the full list of source files to emit. * Else, calls `getSourceFilesT
(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo)
| 109982 | * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. |
| 109983 | */ |
| 109984 | function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo) { |
| 109985 | if (forceDtsEmit === void 0) { forceDtsEmit = false; } |
| 109986 | var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit); |
| 109987 | var options = host.getCompilerOptions(); |
| 109988 | if (ts.outFile(options)) { |
| 109989 | var prepends = host.getPrependNodes(); |
| 109990 | if (sourceFiles.length || prepends.length) { |
| 109991 | var bundle = ts.factory.createBundle(sourceFiles, prepends); |
| 109992 | var result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle); |
| 109993 | if (result) { |
| 109994 | return result; |
| 109995 | } |
| 109996 | } |
| 109997 | } |
| 109998 | else { |
| 109999 | if (!onlyBuildInfo) { |
| 110000 | for (var _a = 0, sourceFiles_1 = sourceFiles; _a < sourceFiles_1.length; _a++) { |
| 110001 | var sourceFile = sourceFiles_1[_a]; |
| 110002 | var result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile); |
| 110003 | if (result) { |
| 110004 | return result; |
| 110005 | } |
| 110006 | } |
| 110007 | } |
| 110008 | if (includeBuildInfo) { |
| 110009 | var buildInfoPath = getTsBuildInfoEmitOutputFilePath(options); |
| 110010 | if (buildInfoPath) |
| 110011 | return action({ buildInfoPath: buildInfoPath }, /*sourceFileOrBundle*/ undefined); |
| 110012 | } |
| 110013 | } |
| 110014 | } |
| 110015 | ts.forEachEmittedFile = forEachEmittedFile; |
| 110016 | function getTsBuildInfoEmitOutputFilePath(options) { |
| 110017 | var configFile = options.configFilePath; |
no test coverage detected
searching dependent graphs…