Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
consumer = await new SourceMapConsumer(converter.toJSON());
}
if (!consumer) {
throw new AppError({ code: 'NoSourceMap' });
}
return {
consumer,
codeFileContent,
};
}
const COMMENT_REGEX = convert.commentRegex;
const MAP_FILE_COMMENT_REGEX = convert.mapFileCommentRegex;
/** Extract either source map comment from file content */
function getSourceMapComment(fileContent: string): string {
const sourceMapComment =
getFirstRegexMatch(COMMENT_REGEX, fileContent) ||
getFirstRegexMatch(MAP_FILE_COMMENT_REGEX, fileContent) ||
'';
// Remove trailing EOLs
return sourceMapComment.trim();
}
const LF = '\n';
const CR_LF = '\r\n';
function sourcemapComments(src) {
var matches = src.match(commentRegex);
return matches ? matches.length : 0;
}