Socket
Socket
Sign inDemoInstall

get-stack-trace

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-stack-trace - npm Package Compare versions

Comparing version 2.1.1 to 3.0.0

.eslintrc

70

package.json

@@ -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"
}

34

README.md
# 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc