{ "_args": [ [ { "raw": "stack-utils@^1.0.1", "scope": null, "escapedName": "stack-utils", "name": "stack-utils", "rawSpec": "^1.0.1", "spec": ">=1.0.1 <2.0.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jest-message-util" ] ], "_from": "stack-utils@>=1.0.1 <2.0.0", "_id": "stack-utils@1.0.1", "_inCache": true, "_location": "/stack-utils", "_nodeVersion": "8.0.0-pre", "_npmOperationalInternal": { "host": "packages-18-east.internal.npmjs.com", "tmp": "tmp/stack-utils-1.0.1.tgz_1492979544062_0.2575548014137894" }, "_npmUser": { "name": "isaacs", "email": "i@izs.me" }, "_npmVersion": "4.5.0", "_phantomChildren": {}, "_requested": { "raw": "stack-utils@^1.0.1", "scope": null, "escapedName": "stack-utils", "name": "stack-utils", "rawSpec": "^1.0.1", "spec": ">=1.0.1 <2.0.0", "type": "range" }, "_requiredBy": [ "/jest-message-util" ], "_resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz", "_shasum": "d4f33ab54e8e38778b0ca5cfd3b3afb12db68620", "_shrinkwrap": null, "_spec": "stack-utils@^1.0.1", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jest-message-util", "author": { "name": "James Talmage", "email": "james@talmage.io", "url": "github.com/jamestalmage" }, "bugs": { "url": "https://github.com/tapjs/stack-utils/issues" }, "dependencies": {}, "description": "Captures and cleans stack traces", "devDependencies": { "bluebird": "^3.1.1", "coveralls": "^2.11.6", "flatten": "0.0.1", "nested-error-stacks": "^2.0.0", "pify": "^2.3.0", "q": "^1.4.1", "tap": "^10.3.2" }, "directories": {}, "dist": { "shasum": "d4f33ab54e8e38778b0ca5cfd3b3afb12db68620", "tarball": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz" }, "engines": { "node": ">=0.10.0" }, "files": [ "index.js" ], "gitHead": "f080bcb2ee9be20520cfb312837d6056011e9094", "homepage": "https://github.com/tapjs/stack-utils#readme", "keywords": [], "license": "MIT", "maintainers": [ { "name": "isaacs", "email": "i@izs.me" }, { "name": "jamestalmage", "email": "james@talmage.io" } ], "name": "stack-utils", "optionalDependencies": {}, "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.\n`StackUtils.nodeInternals()` returns a relatively set of sensible defaults for use on the node platform.\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)\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).\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 - `typename`: `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", "readmeFilename": "readme.md", "repository": { "type": "git", "url": "git+https://github.com/tapjs/stack-utils.git" }, "scripts": { "postpublish": "git push origin --all; git push origin --tags", "postversion": "npm publish", "preversion": "npm test", "test": "tap test/*.js --100 -J" }, "version": "1.0.1" }