{"name":"stacktrace-gps","description":"Turns partial code location into precise code location","maintainers":[{"name":"eriwen","email":"me@eriwen.com"},{"name":"niftylettuce","email":"niftylettuce@gmail.com"},{"name":"oliversalzburg","email":"oliver.salzburg@gmail.com"},{"name":"titanism","email":"npm@titanism.com"}],"version":"3.1.1","license":"MIT","keywords":["stacktrace","error","debugger"],"homepage":"https://www.stacktracejs.com","repository":{"type":"git","url":"git://github.com/stacktracejs/stacktrace-gps.git"},"dependencies":{"source-map":"0.5.6","stackframe":"^1.3.2"},"devDependencies":{"es6-promise":"^3.3.1","eslint":"^8.17.0","jasmine":"^2.7.0","jasmine-ajax":"^3.3.1","jasmine-core":"^2.7.0","karma":"^6.3.20","karma-chrome-launcher":"^3.1.1","karma-coverage":"^2.2.0","karma-coveralls":"^2.1.0","karma-firefox-launcher":"^2.1.2","karma-ie-launcher":"^1.0.0","karma-jasmine":"^1.1.2","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-phantomjs-launcher":"^1.0.4","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-spec-reporter":"^0.0.34","run-sequence":"^1.2.2","uglify-es":"^3.3.9","webpack":"^4.46.0","webpack-cli":"^3.3.12"},"bugs":{"url":"https://github.com/stacktracejs/stacktrace-gps/issues"},"main":"./stacktrace-gps.js","typings":"./stacktrace-gps.d.ts","scripts":{"lint":"eslint --fix stacktrace-gps.js spec/","prepare":"cp stacktrace-gps.js polyfills.js dist/ && ./node_modules/.bin/webpack --mode production && uglifyjs node_modules/stackframe/stackframe.js ./build/bundle.js stacktrace-gps.js -o dist/stacktrace-gps.min.js --compress --mangle --source-map \"url=stacktrace-gps.min.js.map\" && uglifyjs node_modules/es6-promise/dist/es6-promise.js polyfills.js node_modules/stackframe/stackframe.js build/bundle.js stacktrace-gps.js -o dist/stacktrace-gps-with-polyfills.min.js --compress --mangle --source-map \"url=stacktrace-gps-polyfilled.min.js.map\"","test":"karma start karma.conf.js --single-run","test-pr":"karma start karma.conf.js --single-run --browsers Firefox,Chrome_No_Sandbox","test-ci":"karma start karma.conf.ci.js --single-run"},"gitHead":"5d94b9771373fb98d66d6dbe9e9d94ef7708a454","_id":"stacktrace-gps@3.1.1","_nodeVersion":"16.15.0","_npmVersion":"8.5.0","dist":{"integrity":"sha512-3YBg115olgCAIuU2qIKhGys+r8MVvsNIgNK4teZmV6xv1MpSmFI1mkH8b1/gfSkQHCg2bQRRhqzNXn5DI8GHgg==","shasum":"51df80a926c2c7a463793e7007bb854621d2dc0b","tarball":"http://registry-npm.ywwl.com/stacktrace-gps/download/stacktrace-gps-3.1.1.tgz","fileCount":11,"unpackedSize":165473,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+1AuCiYhZn9rqaoeTZPdHC+jzLksKnr60/L1V4y5PTwIgGHeXVE8Di7t/5FNS4YlbLgFwOBhyTvorRpBv4PIGSBM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJinX/tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrbkw/9HM4J/aQ9ihfXXbAMwrIn+klfqUUtvu0gHjM64LpWIWS7hWT4\r\nYfqG7fJJU5PHwPr0g1m2wkLiL/MsHagOsg1udmVDOSix1bCEllHrk411Nsvc\r\nB57ckUeBtAmMPspDPvyABrexiO/NnwYFEty4qryqGnrKWgL6CX3aAwkUfKKj\r\n4BJYgdi9bOVp0qn+sOHE6cAy7v2nQm3JgdU4Ss/XR5uJJDRAvYWW23OCmgNs\r\nXdvfiLWqtpZOTPllc/G1+yUB7Ptnq/lbFKqEmHKnX1wIoz2N2CGmmbWMrPTl\r\njFhiWmhCBYyMzV+5mKHy9LrKrC6i3mkzUCTqnJUQNMZ2FHREIYQCIgeHYkHN\r\n0MefxwGH4uviwmQ0CWAhBLjpQ0LCdkBHwFhkT2tGF6om/ERt1nyczPnXPUng\r\nUx4Z/QIpyf9UfnFWg9IIU1xDbJV7fSJnn707H5pIv39wUvrTzeu+wctBWwN1\r\n2w2rJBgTtokutt644iiotp6QCcUTcvmvtmKsxYM97lgI6PaQl7LH9xzrWfWS\r\nTAAsCJSmyLIvz4t/l9oe241xUVrJZwN97gFs+bKJ6xfE8SX0qGTp3Sc1onBQ\r\n/55ww78ZQhlB8pg/qU3KT9E+wlAFF1Uk+uDxbSMOtV3CGQtUA4HKxy58YuhY\r\nTv3N8IpMW8JWncXRdXgMJEGzLB/5njMCPL0=\r\n=3afZ\r\n-----END PGP SIGNATURE-----\r\n","size":45626,"noattachment":false,"key":"/stacktrace-gps/-/stacktrace-gps-3.1.1.tgz"},"_npmUser":{"name":"eriwen","email":"me@eriwen.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stacktrace-gps_3.1.1_1654489069329_0.5244641044346143"},"_hasShrinkwrap":false,"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":1654489069543,"_cnpm_publish_time":1654489069543,"dist-tags":{"latest":"3.1.2","next":"2.4.0"}}