stacktrace-gps - Turn partial code location into precise code location
This library accepts a code location (in the form of a StackFrame) and
returns a new StackFrame with a more accurate location (using source maps) and guessed function names.
This is primarily a browser-centric library, but can be used with node.js. See the Offline Usage section below.
Usage
var stackframe = new StackFrame({fileName: 'http://localhost:3000/file.min.js', lineNumber: 1, columnNumber: 3284});var callback = function myCallback(foundFunctionName) { console.log(foundFunctionName); };// Such meta. Wowvar errback = function myErrback(error) { console.log(StackTrace.fromError(error)); };var gps = new StackTraceGPS();// Pinpoint actual function name and source-mapped locationgps.pinpoint(stackframe).then(callback, errback);//===> Promise(StackFrame({functionName: 'fun', fileName: 'file.js', lineNumber: 203, columnNumber: 9}), Error)// Better location/name information from source mapsgps.getMappedLocation(stackframe).then
Offline Usage
With a bit of preparation, you can use this library offline in any environment. Any encountered fileNames not in the cache return resolved
Promises with the original StackFrame. StackTraceGPS will make a best effort to provide as good of response with what is given and will
fallback to the original StackFrame if nothing better could be found.