Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createFunctionNameGetter(
module: ExplodedSourceMapModule,
): Position => ?string {
const consumer = new SourceMetadataMapConsumer(
{
version: 3,
mappings: '',
sources: ['dummy'],
names: [],
x_facebook_sources: [[module.functionMap]],
},
name => name /* no normalization needed */,
);
return ({line1Based, column0Based}) =>
consumer.functionNameFor({
line: line1Based,
column: column0Based,
source: 'dummy',
});
}
function mapFrame(frame, contexts) {
const sourceUrl = frame.file;
const context = contexts.get(sourceUrl);
if (context == null) {
return frame;
}
const original = Symbolication.getOriginalPositionFor(
frame.lineNumber,
frame.column,
null, // No module IDs in DEV
context,
);
if (!original || !original.source) {
return frame;
}
return Object.assign({}, frame, {
file: original.source,
lineNumber: original.line,
column: original.column,
methodName: original.name || frame.methodName,
});
}
function mapToContext(tuple) {
tuple[1] = Symbolication.createContext(SourceMapConsumer, tuple[1]);
return tuple;
}