(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions)
| 89983 | var ts; |
| 89984 | (function (ts) { |
| 89985 | function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) { |
| 89986 | var _a = generatorOptions.extendedDiagnostics |
| 89987 | ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap") |
| 89988 | : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit; |
| 89989 | // Current source map file and its index in the sources list |
| 89990 | var rawSources = []; |
| 89991 | var sources = []; |
| 89992 | var sourceToSourceIndexMap = new ts.Map(); |
| 89993 | var sourcesContent; |
| 89994 | var names = []; |
| 89995 | var nameToNameIndexMap; |
| 89996 | var mappingCharCodes = []; |
| 89997 | var mappings = ""; |
| 89998 | // Last recorded and encoded mappings |
| 89999 | var lastGeneratedLine = 0; |
| 90000 | var lastGeneratedCharacter = 0; |
| 90001 | var lastSourceIndex = 0; |
| 90002 | var lastSourceLine = 0; |
| 90003 | var lastSourceCharacter = 0; |
| 90004 | var lastNameIndex = 0; |
| 90005 | var hasLast = false; |
| 90006 | var pendingGeneratedLine = 0; |
| 90007 | var pendingGeneratedCharacter = 0; |
| 90008 | var pendingSourceIndex = 0; |
| 90009 | var pendingSourceLine = 0; |
| 90010 | var pendingSourceCharacter = 0; |
| 90011 | var pendingNameIndex = 0; |
| 90012 | var hasPending = false; |
| 90013 | var hasPendingSource = false; |
| 90014 | var hasPendingName = false; |
| 90015 | return { |
| 90016 | getSources: function () { return rawSources; }, |
| 90017 | addSource: addSource, |
| 90018 | setSourceContent: setSourceContent, |
| 90019 | addName: addName, |
| 90020 | addMapping: addMapping, |
| 90021 | appendSourceMap: appendSourceMap, |
| 90022 | toJSON: toJSON, |
| 90023 | toString: function () { return JSON.stringify(toJSON()); } |
| 90024 | }; |
| 90025 | function addSource(fileName) { |
| 90026 | enter(); |
| 90027 | var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, fileName, host.getCurrentDirectory(), host.getCanonicalFileName, |
| 90028 | /*isAbsolutePathAnUrl*/ true); |
| 90029 | var sourceIndex = sourceToSourceIndexMap.get(source); |
| 90030 | if (sourceIndex === undefined) { |
| 90031 | sourceIndex = sources.length; |
| 90032 | sources.push(source); |
| 90033 | rawSources.push(fileName); |
| 90034 | sourceToSourceIndexMap.set(source, sourceIndex); |
| 90035 | } |
| 90036 | exit(); |
| 90037 | return sourceIndex; |
| 90038 | } |
| 90039 | /* eslint-disable boolean-trivia, no-null/no-null */ |
| 90040 | function setSourceContent(sourceIndex, content) { |
| 90041 | enter(); |
| 90042 | if (content !== null) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…