{"bugs":{"url":"https://github.com/tapjs/stack-utils/issues"},"dist":{"shasum":"a19b0b01947e0029c8e451d5d61a498f5bb1471b","tarball":"https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.5.tgz","fileCount":4,"integrity":"sha512-KZiTzuV3CnSnSvgMRrARVCj+Ht7rMbauGDK0LdVFRGyenwdylpajAp4Q0i6SX8rEmbTpMMf6ryq2gb8pPq2WgQ==","signatures":[{"sig":"MEUCIApQTS0pVf6u+OiKro9V+zhPApNUS/p7tEcdfg++L8MNAiEAnsEp1eBxqX8IYwkKr4DrAg1AQ8hLWP8ymAeb/ZUs3Go=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14631,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga1NeCRA9TVsSAnZWagAAzPgQAKSoV7e5pMl44n7c2C7M\n3pNk9hudEKkRdIbca7CpB9gmceQvYvzzoUGnIXqVViA9vu9l/HFL23FlEd5c\n61tKJ/IfIi1w50PSr9d552Xby7tLZB9k/oe019KIuE5zxXj54ejlXwp3RHJF\nGEgqGr5f8WwDz50foLUHRvY8/XGUY2lKoLfTEU8HqY2uaS+KD3AW8kYILy4F\ntzEkrymF9qk8xPHA4gpK/5rIKvkCqm6tqXjzVbQBFl6YY/7fGSlkheqHp1xp\n+hcVfZCP6eq8/yzoe+j7aEjAYVZ1UkaRGfAO/vCTMMjlH9P5bCOLYS0S2FWY\nyM2qkrdp1WjDntIyPKAA1xi6Upmle8Wo7DeegBp0iCV+Jjc3wAWCm7gKnI/E\nQ15C2lciFnumGqIeDPCHbaOVmIFPYnb4UGvVa971uPbbVYGUeLJ5IXLHPTPa\nK8RNgTUYF+erhgFhG2njPaWr5QgyA15gDWIKLidfP1g0a0cssMFJ2fbxcIcj\nMrSnvmXAEiY2o5aqSj1dsQbwTcGxQoJUTUi2PbjnWegXItNWxjEAfXhpzwFS\nJr2ZjEJApj+ut6+oFVp5oJWrb0ne9bSQLDtRLo/O0itMwqBzEB0pdAJOJ6jW\nlwmRRbaXUx9rCNoMtx3O3LNA7aO+uZcTfvxB1EcFR+6NTxI+vYIB+K0s3xgT\nvGjb\r\n=l7SS\r\n-----END PGP SIGNATURE-----\r\n"},"name":"stack-utils","author":{"url":"github.com/jamestalmage","name":"James Talmage","email":"james@talmage.io"},"readme":"# stack-utils \n\n> Captures and cleans stack traces.\n\n[![Linux Build](https://travis-ci.org/tapjs/stack-utils.svg?branch=master)](https://travis-ci.org/tapjs/stack-utils) [![Build status](https://ci.appveyor.com/api/projects/status/fb9i157knoixe3iq/branch/master?svg=true)](https://ci.appveyor.com/project/jamestalmage/stack-utils-oiw96/branch/master)  [![Coverage](https://coveralls.io/repos/tapjs/stack-utils/badge.svg?branch=master&service=github)](https://coveralls.io/github/tapjs/stack-utils?branch=master)\n\n\nExtracted from `lib/stack.js` in the [`node-tap` project](https://github.com/tapjs/node-tap)\n\n## Install\n\n```\n$ npm install --save stack-utils\n```\n\n\n## Usage\n\n```js\nconst StackUtils = require('stack-utils');\nconst stack = new StackUtils({cwd: process.cwd(), internals: StackUtils.nodeInternals()});\n\nconsole.log(stack.clean(new Error().stack));\n// outputs a beautified stack trace\n```\n\n\n## API\n\n\n### new StackUtils([options])\n\nCreates a new `stackUtils` instance.\n\n#### options\n\n##### internals\n\nType: `array` of `RegularExpression`s  \n\nA set of regular expressions that match internal stack stack trace lines which should be culled from the stack trace.\nThe default is `StackUtils.nodeInternals()`, this can be disabled by setting `[]` or appended using\n`StackUtils.nodeInternals().concat(additionalRegExp)`.  See also `ignoredPackages`.\n\n##### ignoredPackages\n\nType: `array` of `string`s\n\nAn array of npm modules to be culled from the stack trace.  This list will mapped to regular\nexpressions and merged with the `internals`.\n\nDefault `''`.\n\n##### cwd\n\nType: `string`\n\nThe path to the current working directory. File names in the stack trace will be shown relative to this directory.\n\n##### wrapCallSite\n\nType: `function(CallSite)`\n\nA mapping function for manipulating CallSites before processing. The first argument is a CallSite instance, and the function should return a modified CallSite. This is useful for providing source map support.\n\n\n### StackUtils.nodeInternals()\n\nReturns an array of regular expressions that be used to cull lines from the stack trace that reference common Node.js internal files.\n\n\n### stackUtils.clean(stack, indent = 0)\n\nCleans up a stack trace by deleting any lines that match the `internals` passed to the constructor, and shortening file names relative to `cwd`.\n\nReturns a `string` with the cleaned up stack (always terminated with a `\\n` newline character).\nSpaces at the start of each line are trimmed, indentation can be added by setting `indent` to the desired number of spaces.\n\n#### stack\n\n*Required*  \nType: `string` or an `array` of `string`s\n\n\n### stackUtils.capture([limit], [startStackFunction])\n\nCaptures the current stack trace, returning an array of `CallSite`s. There are good overviews of the available CallSite methods [here](https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces), and [here](https://github.com/sindresorhus/callsites#api).\n\n#### limit\n\nType: `number`\nDefault: `Infinity`\n\nLimits the number of lines returned by dropping all lines in excess of the limit. This removes lines from the stack trace.\n\n#### startStackFunction\n\nType: `function`\n\nThe function where the stack trace should start. The first line of the stack trace will be the function that called `startStackFunction`. This removes lines from the end of the stack trace.\n\n\n### stackUtils.captureString([limit], [startStackFunction])\n\nCaptures the current stack trace, cleans it using `stackUtils.clean(stack)`, and returns a string with the cleaned stack trace. It takes the same arguments as `stackUtils.capture`.\n\n\n### stackUtils.at([startStackFunction])\n\nCaptures the first line of the stack trace (or the first line after `startStackFunction` if supplied), and returns a `CallSite` like object that is serialization friendly (properties are actual values instead of getter functions). \n\nThe available properties are:\n\n - `line`: `number` \n - `column`: `number`\n - `file`: `string`\n - `constructor`: `boolean`\n - `evalOrigin`: `string`\n - `native`: `boolean`\n - `type`: `string`\n - `function`: `string`\n - `method`: `string`\n\n### stackUtils.parseLine(line)\n\nParses a `string` (which should be a single line from a stack trace), and generates an object with the following properties:\n\n - `line`: `number` \n - `column`: `number`\n - `file`: `string`\n - `constructor`: `boolean`\n - `evalOrigin`: `string`\n - `evalLine`: `number`\n - `evalColumn`: `number`\n - `evalFile`: `string`\n - `native`: `boolean`\n - `function`: `string`\n - `method`: `string`\n\n\n## License\n\nMIT © [Isaac Z. Schlueter](http://github.com/isaacs), [James Talmage](http://github.com/jamestalmage)\n","engines":{"node":">=8"},"gitHead":"3fedcb900446a4d47d764a98d91d8d989b7c2e2b","license":"MIT","scripts":{"test":"tap --no-esm --100","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"homepage":"https://github.com/tapjs/stack-utils#readme","repository":{"url":"git+https://github.com/tapjs/stack-utils.git","type":"git"},"_npmVersion":"7.7.6","description":"Captures and cleans stack traces","directories":{},"maintainers":[{"name":"jamestalmage","email":"james@talmage.io"},{"name":"isaacs","email":"i@izs.me"}],"_nodeVersion":"15.3.0","dependencies":{"escape-string-regexp":"^2.0.0"},"publishConfig":{"tag":"v1-legacy"},"_hasShrinkwrap":false,"readmeFilename":"readme.md","devDependencies":{"q":"^1.5.1","tap":"^14.10.8","pify":"^4.0.1","bluebird":"^3.7.2","coveralls":"^3.0.9","nested-error-stacks":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/stack-utils_1.0.5_1617646430240_0.610412032205589","host":"s3://npm-registry-packages"},"_id":"stack-utils@1.0.5","version":"1.0.5"}