* Gets the program information to be emitted in buildInfo so that we can use it to create new program
(state, getCanonicalFileName)
| 120555 | * Gets the program information to be emitted in buildInfo so that we can use it to create new program |
| 120556 | */ |
| 120557 | function getProgramBuildInfo(state, getCanonicalFileName) { |
| 120558 | if (ts.outFile(state.compilerOptions)) |
| 120559 | return undefined; |
| 120560 | var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory(); |
| 120561 | var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory)); |
| 120562 | var fileNames = []; |
| 120563 | var fileNameToFileId = new ts.Map(); |
| 120564 | var fileIdsList; |
| 120565 | var fileNamesToFileIdListId; |
| 120566 | var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) { |
| 120567 | var key = _a[0], value = _a[1]; |
| 120568 | // Ensure fileId |
| 120569 | var fileId = toFileId(key); |
| 120570 | ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key)); |
| 120571 | var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key); |
| 120572 | var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature; |
| 120573 | return value.version === actualSignature ? |
| 120574 | value.affectsGlobalScope || value.impliedFormat ? |
| 120575 | // If file version is same as signature, dont serialize signature |
| 120576 | { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } : |
| 120577 | // If file info only contains version and signature and both are same we can just write string |
| 120578 | value.version : |
| 120579 | actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo |
| 120580 | signature === undefined ? |
| 120581 | // If we havent computed signature, use fileInfo as is |
| 120582 | value : |
| 120583 | // Serialize fileInfo with new updated signature |
| 120584 | { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } : |
| 120585 | // Signature of the FileInfo is undefined, serialize it as false |
| 120586 | { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat }; |
| 120587 | }); |
| 120588 | var referencedMap; |
| 120589 | if (state.referencedMap) { |
| 120590 | referencedMap = ts.arrayFrom(state.referencedMap.keys()).sort(ts.compareStringsCaseSensitive).map(function (key) { return [ |
| 120591 | toFileId(key), |
| 120592 | toFileIdListId(state.referencedMap.getValues(key)) |
| 120593 | ]; }); |
| 120594 | } |
| 120595 | var exportedModulesMap; |
| 120596 | if (state.exportedModulesMap) { |
| 120597 | exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) { |
| 120598 | var _a; |
| 120599 | if (state.currentAffectedFilesExportedModulesMap) { |
| 120600 | if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) { |
| 120601 | return undefined; |
| 120602 | } |
| 120603 | var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key); |
| 120604 | if (newValue) { |
| 120605 | return [toFileId(key), toFileIdListId(newValue)]; |
| 120606 | } |
| 120607 | } |
| 120608 | // Not in temporary cache, use existing value |
| 120609 | return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))]; |
| 120610 | }); |
| 120611 | } |
| 120612 | var semanticDiagnosticsPerFile; |
| 120613 | if (state.semanticDiagnosticsPerFile) { |
| 120614 | for (var _i = 0, _a = ts.arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) { |
no test coverage detected
searching dependent graphs…