* Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host * in that order would be used to write the f
(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)
| 120827 | * in that order would be used to write the files |
| 120828 | */ |
| 120829 | function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { |
| 120830 | var affected = getNextAffectedFile(state, cancellationToken, computeHash, host); |
| 120831 | var emitKind = 1 /* BuilderFileEmit.Full */; |
| 120832 | var isPendingEmitFile = false; |
| 120833 | if (!affected) { |
| 120834 | if (!ts.outFile(state.compilerOptions)) { |
| 120835 | var pendingAffectedFile = getNextAffectedFilePendingEmit(state); |
| 120836 | if (!pendingAffectedFile) { |
| 120837 | if (!state.buildInfoEmitPending) { |
| 120838 | return undefined; |
| 120839 | } |
| 120840 | var affected_1 = ts.Debug.checkDefined(state.program); |
| 120841 | return toAffectedFileEmitResult(state, |
| 120842 | // When whole program is affected, do emit only once (eg when --out or --outFile is specified) |
| 120843 | // Otherwise just affected file |
| 120844 | affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1, 1 /* BuilderFileEmit.Full */, |
| 120845 | /*isPendingEmitFile*/ false, |
| 120846 | /*isBuildInfoEmit*/ true); |
| 120847 | } |
| 120848 | (affected = pendingAffectedFile.affectedFile, emitKind = pendingAffectedFile.emitKind); |
| 120849 | isPendingEmitFile = true; |
| 120850 | } |
| 120851 | else { |
| 120852 | var program = ts.Debug.checkDefined(state.program); |
| 120853 | if (state.programEmitComplete) |
| 120854 | return undefined; |
| 120855 | affected = program; |
| 120856 | } |
| 120857 | } |
| 120858 | return toAffectedFileEmitResult(state, |
| 120859 | // When whole program is affected, do emit only once (eg when --out or --outFile is specified) |
| 120860 | // Otherwise just affected file |
| 120861 | ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ? |
| 120862 | getWriteFileUpdatingSignatureCallback(writeFile) : |
| 120863 | writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* BuilderFileEmit.DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile); |
| 120864 | } |
| 120865 | function getWriteFileUpdatingSignatureCallback(writeFile) { |
| 120866 | return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) { |
| 120867 | var _a; |
no test coverage detected
searching dependent graphs…