(
opts?: api.EmitOptions<CbEmitRes> | undefined,
)
| 277 | } |
| 278 | |
| 279 | emit<CbEmitRes extends ts.EmitResult>( |
| 280 | opts?: api.EmitOptions<CbEmitRes> | undefined, |
| 281 | ): ts.EmitResult { |
| 282 | // Check if emission of the i18n messages bundle was requested. |
| 283 | if ( |
| 284 | opts !== undefined && |
| 285 | opts.emitFlags !== undefined && |
| 286 | opts.emitFlags & api.EmitFlags.I18nBundle |
| 287 | ) { |
| 288 | this.emitXi18n(); |
| 289 | |
| 290 | // `api.EmitFlags` is a View Engine compiler concept. We only pay attention to the absence of |
| 291 | // the other flags here if i18n emit was requested (since this is usually done in the xi18n |
| 292 | // flow, where we don't want to emit JS at all). |
| 293 | if (!(opts.emitFlags & api.EmitFlags.JS)) { |
| 294 | return { |
| 295 | diagnostics: [], |
| 296 | emitSkipped: true, |
| 297 | emittedFiles: [], |
| 298 | }; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | const forceEmit = opts?.forceEmit ?? false; |
| 303 | |
| 304 | this.compiler.perfRecorder.memory(PerfCheckpoint.PreEmit); |
| 305 | |
| 306 | const res = this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptEmit, () => { |
| 307 | const {transformers} = this.compiler.prepareEmit(); |
| 308 | const ignoreFiles = this.compiler.ignoreForEmit; |
| 309 | const emitCallback = (opts?.emitCallback ?? |
| 310 | defaultEmitCallback) as api.TsEmitCallback<CbEmitRes>; |
| 311 | |
| 312 | const writeFile: ts.WriteFileCallback = ( |
| 313 | fileName: string, |
| 314 | data: string, |
| 315 | writeByteOrderMark: boolean, |
| 316 | onError: ((message: string) => void) | undefined, |
| 317 | sourceFiles: ReadonlyArray<ts.SourceFile> | undefined, |
| 318 | ) => { |
| 319 | if (sourceFiles !== undefined) { |
| 320 | // Record successful writes for any `ts.SourceFile` (that's not a declaration file) |
| 321 | // that's an input to this write. |
| 322 | for (const writtenSf of sourceFiles) { |
| 323 | if (writtenSf.isDeclarationFile) { |
| 324 | continue; |
| 325 | } |
| 326 | |
| 327 | this.compiler.incrementalCompilation.recordSuccessfulEmit(writtenSf); |
| 328 | } |
| 329 | } |
| 330 | this.host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); |
| 331 | }; |
| 332 | |
| 333 | const customTransforms = opts && opts.customTransformers; |
| 334 | const beforeTransforms = transformers.before || []; |
| 335 | const afterDeclarationsTransforms = transformers.afterDeclarations; |
| 336 |
nothing calls this directly
no test coverage detected