get-stack-trace
Advanced tools
Comparing version 2.1.1 to 3.0.0
@@ -5,61 +5,21 @@ { | ||
"name": "Gajus Kuizinas", | ||
"url": "http://gajus.com" | ||
"url": "https://gajus.com" | ||
}, | ||
"ava": { | ||
"require": [ | ||
"@babel/register" | ||
] | ||
}, | ||
"dependencies": { | ||
"bluebird": "^3.7.1", | ||
"source-map": "^0.8.0-beta.0" | ||
}, | ||
"description": "V8 stack traces with optional source map resolution.", | ||
"description": "V8 stack traces", | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.0", | ||
"@babel/core": "^7.7.2", | ||
"@babel/node": "^7.7.0", | ||
"@babel/plugin-transform-flow-strip-types": "^7.6.3", | ||
"@babel/preset-env": "^7.7.1", | ||
"@babel/register": "^7.7.0", | ||
"ava": "^2.4.0", | ||
"babel-plugin-istanbul": "^5.2.0", | ||
"babel-plugin-transform-export-default-name": "^2.0.4", | ||
"coveralls": "^3.0.8", | ||
"eslint": "^6.6.0", | ||
"eslint-config-canonical": "^18.1.0", | ||
"flow-bin": "^0.112.0", | ||
"flow-copy-source": "^2.0.9", | ||
"husky": "^3.1.0", | ||
"mock-fs": "^5.0.0", | ||
"nodemark": "^0.3.0", | ||
"nyc": "^14.1.1" | ||
"@semantic-release/commit-analyzer": "^11.0.0", | ||
"@semantic-release/github": "^9.1.0", | ||
"@semantic-release/npm": "^11.0.0", | ||
"eslint": "^8.50.0", | ||
"eslint-config-canonical": "^41.2.3", | ||
"vitest": "^0.34.5" | ||
}, | ||
"engines": { | ||
"node": ">=8.0" | ||
"node": ">=18.0" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run lint && npm run test && npm run build" | ||
} | ||
}, | ||
"keywords": [ | ||
"stack trace", | ||
"source map" | ||
"stack trace" | ||
], | ||
"main": "./dist/index.js", | ||
"name": "get-stack-trace", | ||
"nyc": { | ||
"include": [ | ||
"src/**/*.js" | ||
], | ||
"instrument": false, | ||
"reporter": [ | ||
"text-summary" | ||
], | ||
"require": [ | ||
"@babel/register" | ||
], | ||
"sourceMap": false | ||
}, | ||
"repository": { | ||
@@ -70,9 +30,7 @@ "type": "git", | ||
"scripts": { | ||
"build": "rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && flow-copy-source src dist", | ||
"dev": "NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps --watch", | ||
"lint": "eslint ./src ./test && flow", | ||
"test": "NODE_ENV=test nyc ava --verbose --serial --concurrency 1", | ||
"benchmark": "node performance/benchmark.js" | ||
"build": "rm -fr ./dist && tsc --project tsconfig.build.json", | ||
"lint": "eslint . && tsc --noEmit", | ||
"test": "vitest" | ||
}, | ||
"version": "2.1.1" | ||
"version": "3.0.0" | ||
} |
# get-stack-trace | ||
[![Travis build status](http://img.shields.io/travis/gajus/get-stack-trace/master.svg?style=flat-square)](https://travis-ci.org/gajus/get-stack-trace) | ||
[![Coveralls](https://img.shields.io/coveralls/gajus/get-stack-trace.svg?style=flat-square)](https://coveralls.io/github/gajus/get-stack-trace) | ||
[![NPM version](http://img.shields.io/npm/v/get-stack-trace.svg?style=flat-square)](https://www.npmjs.org/package/get-stack-trace) | ||
@@ -9,29 +7,4 @@ [![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical) | ||
[V8 stack traces](https://github.com/v8/v8/wiki/Stack-Trace-API) with optional source map resolution. | ||
[V8 stack traces](https://github.com/v8/v8/wiki/Stack-Trace-API) as an object. | ||
## Motivation | ||
A lot of NPM packages are transpiled either using Babel or TypeScript. | ||
This means that if you attempt to resolve a [CallSite](https://github.com/v8/v8/wiki/Stack-Trace-API#customizing-stack-traces) using [`Error.prepareStackTrace`](https://github.com/v8/v8/wiki/Stack-Trace-API#customizing-stack-traces) and [`Error.captureStackTrace`](https://nodejs.org/api/errors.html#errors_error_capturestacktrace_targetobject_constructoropt), the resulting CallSite object will reference the tranpiled file, rather than the original source file. However, if the project was distributed with source maps, then we can use the available source maps to resolve the original CallSite. | ||
In practise, this is useful if the intent is to log the stack trace of an application at a particular time in execution, e.g. Slonik [creates a stack trace prior to every asynchronous call](https://github.com/gajus/slonik#slonik-debugging-log-stack-trace) for debugging purposes. | ||
For the stack traces to resolve, packages must be distributed with a source map file along with the transpiled file, e.g. such as in the case of this project: | ||
```bash | ||
$ cd ./dist && tree . | ||
. | ||
âââ index.js | ||
âââ index.js.flow | ||
âââ index.js.map | ||
âââ test.js | ||
âââ test.js.flow | ||
âââ test.js.map | ||
âââ types.js | ||
âââ types.js.flow | ||
âââ types.js.map | ||
``` | ||
## Usage | ||
@@ -41,7 +14,6 @@ | ||
import { | ||
getStackTrace | ||
getStackTrace, | ||
} from 'get-stack-trace'; | ||
const stackTrace = await getStackTrace(); | ||
const stackTrace = getStackTrace(); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
6
0
7538
16
102
18
1
- Removedbluebird@^3.7.1
- Removedsource-map@^0.8.0-beta.0
- Removedbluebird@3.7.2(transitive)
- Removedlodash.sortby@4.7.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedsource-map@0.8.0-beta.0(transitive)
- Removedtr46@1.0.1(transitive)
- Removedwebidl-conversions@4.0.2(transitive)
- Removedwhatwg-url@7.1.0(transitive)