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

Function getSourceMappingURL

test/fixtures/snapshot/typescript.js:110496–110524  ·  view source on GitHub ↗
(mapOptions, sourceMapGenerator, filePath, sourceMapFilePath, sourceFile)

Source from the content-addressed store, hash-verified

110494 return ts.getDirectoryPath(ts.normalizePath(filePath));
110495 }
110496 function getSourceMappingURL(mapOptions, sourceMapGenerator, filePath, sourceMapFilePath, sourceFile) {
110497 if (mapOptions.inlineSourceMap) {
110498 // Encode the sourceMap into the sourceMap url
110499 var sourceMapText = sourceMapGenerator.toString();
110500 var base64SourceMapText = ts.base64encode(ts.sys, sourceMapText);
110501 return "data:application/json;base64,".concat(base64SourceMapText);
110502 }
110503 var sourceMapFile = ts.getBaseFileName(ts.normalizeSlashes(ts.Debug.checkDefined(sourceMapFilePath)));
110504 if (mapOptions.mapRoot) {
110505 var sourceMapDir = ts.normalizeSlashes(mapOptions.mapRoot);
110506 if (sourceFile) {
110507 // For modules or multiple emit files the mapRoot will have directory structure like the sources
110508 // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map
110509 sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFile.fileName, host, sourceMapDir));
110510 }
110511 if (ts.getRootLength(sourceMapDir) === 0) {
110512 // The relative paths are relative to the common directory
110513 sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
110514 return encodeURI(ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath
110515 ts.combinePaths(sourceMapDir, sourceMapFile), // this is where user expects to see sourceMap
110516 host.getCurrentDirectory(), host.getCanonicalFileName,
110517 /*isAbsolutePathAnUrl*/ true));
110518 }
110519 else {
110520 return encodeURI(ts.combinePaths(sourceMapDir, sourceMapFile));
110521 }
110522 }
110523 return encodeURI(sourceMapFile);
110524 }
110525 }
110526 ts.emitFiles = emitFiles;
110527 /*@internal*/

Callers 1

printSourceFileOrBundleFunction · 0.85

Calls 2

concatMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected