{"name":"stacktrace-gps","description":"Turns partial code location into precise code location","maintainers":[{"name":"eriwen","email":"me@eriwen.com"},{"name":"oliversalzburg","email":"oliver.salzburg@gmail.com"}],"version":"2.3.0","license":"SEE LICENSE IN LICENSE","keywords":["stacktrace","error","debugger"],"homepage":"http://www.stacktracejs.com","repository":{"type":"git","url":"git://github.com/stacktracejs/stacktrace-gps.git"},"dependencies":{"source-map":"^0.5.1","stackframe":"~0.3"},"devDependencies":{"colors":"^1.1.2","del":"^1.2.1","es6-promise":"^3.0.2","gulp":"^3.9.0","gulp-concat":"^2.6.0","gulp-coveralls":"^0.1.4","gulp-jshint":"^1.11.2","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.6.0","gulp-uglify":"^1.4.2","jasmine-node":"~1.14","jasmine-sinon":"^0.4.0","karma":"~0.12","karma-chrome-launcher":"^0.1.5","karma-coverage":"^0.2.6","karma-firefox-launcher":"^0.1.3","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.1.6","karma-opera-launcher":"^0.1.0","karma-phantomjs2-launcher":"^0.3.2","karma-safari-launcher":"^0.1.1","karma-sauce-launcher":"^0.2.10","karma-sinon":"^1.0.3","run-sequence":"^1.1.4","sinon":"^1.17.1","webpack":"^1.12.2"},"bugs":{"url":"https://github.com/stacktracejs/stacktrace-gps/issues"},"main":"./stacktrace-gps.js","files":["LICENSE","README.md","stacktrace-gps.js","dist/","node_modules/source-map/"],"scripts":{"test":"gulp test"},"gitHead":"c0bb7c57a42ddab8a826acdf17188a16ed099aa1","_id":"stacktrace-gps@2.3.0","_shasum":"3e38ebc8d6d133f15ba1f116dcd23664bc69add7","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"eriwen","email":"me@eriwen.com"},"dist":{"shasum":"3e38ebc8d6d133f15ba1f116dcd23664bc69add7","tarball":"http://registry-npm.ywwl.com/stacktrace-gps/download/stacktrace-gps-2.3.0.tgz","integrity":"sha512-/1NU7An4hp6gua/NJipeSMZwtd9AzdtAsRC+PO1yqmtsiy3cHJqDNZvW/TtIAwf8sNeV0/Lhr8h0PJwvpuY/kA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDNVJ+jxx2sHGMdN+ugW7ulv6ILaAaR90LO58lw2CtlSAiAPnTBa13ZxUv4SdDs4L93PIRkdVv8/YvdHDtOmwPczEg=="}],"size":91012,"noattachment":false,"key":"/stacktrace-gps/-/stacktrace-gps-2.3.0.tgz"},"directories":{},"readme":"stacktrace-gps - Turn partial code location into precise code location\n===================\n[![Build Status](https://img.shields.io/github/workflow/status/stacktracejs/stacktrace-gps/Continuous%20Integration/master?logo=github&style=flat-square)](https://github.com/stacktracejs/stacktrace-gps/actions?query=workflow%3AContinuous+Integration+branch%3Amaster)\n[![Coverage Status](https://img.shields.io/coveralls/stacktracejs/stacktrace-gps.svg?style=flat-square)](https://coveralls.io/r/stacktracejs/stacktrace-gps?branch=master)\n[![GitHub license](https://img.shields.io/github/license/stacktracejs/stacktrace-gps.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n\nThis library accepts a code location (in the form of a [StackFrame](https://github.com/stacktracejs/stackframe)) and\nreturns a new StackFrame with a more accurate location (using [source maps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/)) and guessed function names.\n\nThis is primarily a browser-centric library, but can be used with node.js. See the [Offline Usage section](#offline-usage) below.\n\n## Usage\n```js\nvar stackframe = new StackFrame({fileName: 'http://localhost:3000/file.min.js', lineNumber: 1, columnNumber: 3284});\nvar callback = function myCallback(foundFunctionName) { console.log(foundFunctionName); };\n\n// Such meta. Wow\nvar errback = function myErrback(error) { console.log(StackTrace.fromError(error)); };\n\nvar gps = new StackTraceGPS();\n\n// Pinpoint actual function name and source-mapped location\ngps.pinpoint(stackframe).then(callback, errback);\n//===> Promise(StackFrame({functionName: 'fun', fileName: 'file.js', lineNumber: 203, columnNumber: 9}), Error)\n\n// Better location/name information from source maps\ngps.getMappedLocation(stackframe).then(callback, errback);\n//===> Promise(StackFrame({fileName: 'file.js', lineNumber: 203, columnNumber: 9}), Error)\n\n// Get function name from location information\ngps.findFunctionName(stackframe).then(callback, errback);\n//===> Promise(StackFrame({functionName: 'fun', fileName: 'http://localhost:3000/file.min.js', lineNumber: 1, columnNumber: 3284}), Error)\n```\n\n### Offline Usage\nWith a bit of preparation, you can use this library offline in any environment. Any encountered fileNames not in the cache return resolved\nPromises with the original StackFrame. StackTraceGPS will make a best effort to provide as good of response with what is given and will\nfallback to the original StackFrame if nothing better could be found.\n\n```js\nvar stack = ErrorStackParser.parse(new Error('boom'));\nconsole.assert(stack[0] == new StackFrame({fileName: 'http://localhost:9999/file.min.js', lineNumber: 1, columnNumber: 32}));\n\nvar sourceCache = {'http://localhost:9999/file.min.js': 'var foo=function(){};function bar(){}var baz=eval(\"XXX\");\\n//# sourceMappingURL=file.js.map'};\nvar sourceMap = '{\"version\":3,\"sources\":[\"./file.js\"],\"sourceRoot\":\"http://localhost:4000/\",\"names\":[\"foo\",\"bar\",\"baz\",\"eval\"],\"mappings\":\"AAAA,GAAIA,KAAM,YACV,SAASC,QACT,GAAIC,KAAMC,KAAK\",\"file\":\"file.min.js\"}';\nvar sourceMapConsumerCache = {'http://localhost:4000/file.js.map': new SourceMap.SourceMapConsumer(sourceMap)};\n\nvar gps = new StackTraceGPS({offline: true, sourceCache: sourceCache, sourceMapConsumerCache: sourceMapConsumerCache});\ngps.pinpoint(stack[0]).then(function(betterStackFrame) {\n    console.assert(betterStackFrame === new StackFrame({functionName: 'bar', fileName: 'http://localhost:9999/file.js', lineNumber: 2, columnNumber: 9}));\n});\n```\n\n## Installation\n```\nnpm install stacktrace-gps\nbower install stacktrace-gps\nhttps://raw.githubusercontent.com/stacktracejs/stacktrace-gps/master/dist/stacktrace-gps.min.js\n```\n\n## API\n\n#### `new StackTraceGPS(/*optional*/ options)` => StackTraceGPS\noptions: Object\n* **sourceCache: Object (String URL : String Source)** - Pre-populate source cache to avoid network requests\n* **sourceMapConsumerCache: Object (Source Mapping URL : SourceMap.SourceMapConsumer)** - Pre-populate source cache to avoid network requests\n* **offline: Boolean (default false)** - Set to `true` to prevent all network requests\n* **ajax: Function (String URL => Promise(responseText))** - Function to be used for making X-Domain requests\n* **atob: Function (String => String)** - Function to convert base64-encoded strings to their original representation\n\n#### `.pinpoint(stackframe)` => Promise(StackFrame)\nEnhance function name and use source maps to produce a better StackFrame.\n* **stackframe** - [StackFrame](https://github.com/stacktracejs/stackframe) or like object\ne.g. {fileName: 'path/to/file.js', lineNumber: 100, columnNumber: 5}\n\n#### `.findFunctionName(stackframe)` => Promise(StackFrame)\nEnhance function name and use source maps to produce a better StackFrame.\n* **stackframe** - [StackFrame](https://github.com/stacktracejs/stackframe) or like object\n\n#### `.getMappedLocation(stackframe)` => Promise(StackFrame)\nEnhance function name and use source maps to produce a better StackFrame.\n* **stackframe** - [StackFrame](https://github.com/stacktracejs/stackframe) or like object\n\n## Browser Support\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/stacktracejs.svg)](https://saucelabs.com/u/stacktracejs)\n\nFunctions that rely on [Source Maps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/)\n(`pinpoint` and `getMappedLocation`) require recent browsers.\n\n## Contributing\nWant to be listed as a *Contributor*? Start with the [Contributing Guide](.github/CONTRIBUTING.md)!\n","publish_time":1445216306420,"_cnpm_publish_time":1445216306420,"dist-tags":{"latest":"3.1.2","next":"2.4.0"}}