MCPcopy Index your code
hub / github.com/nodejs/node / handleDtsMayChangeOf

Function handleDtsMayChangeOf

test/fixtures/snapshot/typescript.js:120357–120375  ·  view source on GitHub ↗

* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled, * Also we need to make sure signature is updated for these files

(state, path, cancellationToken, computeHash, host)

Source from the content-addressed store, hash-verified

120355 * Also we need to make sure signature is updated for these files
120356 */
120357 function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
120358 removeSemanticDiagnosticsOf(state, path);
120359 if (!state.changedFilesSet.has(path)) {
120360 var program = ts.Debug.checkDefined(state.program);
120361 var sourceFile = program.getSourceFileByPath(path);
120362 if (sourceFile) {
120363 // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
120364 // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
120365 // This ensures that we dont later during incremental builds considering wrong signature.
120366 // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120367 // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120368 ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120369 // If not dts emit, nothing more to do
120370 if (ts.getEmitDeclarations(state.compilerOptions)) {
120371 addToAffectedFilesPendingEmit(state, path, 0 /* BuilderFileEmit.DtsOnly */);
120372 }
120373 }
120374 }
120375 }
120376 /**
120377 * Removes semantic diagnostics for path and
120378 * returns true if there are no more semantic diagnostics from the old state

Calls 3

hasMethod · 0.65

Tested by

no test coverage detected