New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stacktracey

Package Overview
Dependencies
Maintainers
2
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stacktracey - npm Package Compare versions

Comparing version 1.0.22 to 1.0.23

4

package.json
{
"name": "stacktracey",
"version": "1.0.22",
"version": "1.0.23",
"description": "Parses call stacks, reads sources and meta-information.",

@@ -33,4 +33,4 @@ "main": "stacktracey",

"dependencies": {
"get-source": "^1.0.4"
"get-source": "^1.0.5"
}
}

@@ -108,2 +108,8 @@ # StackTracey

You can override `isThirdParty` behaviour by replacing the predicate implementation:
```
StackTracey.isThirdParty = path => path.includes ('jquery')
```
## Array methods

@@ -121,4 +127,4 @@

```
```javascript
StackTracey.locationsEqual (a, b)
```

@@ -23,3 +23,3 @@ "use strict";

input = new Error ()
offset = isBrowser ? 0 : 1 }
offset = (offset === undefined) ? 1 : offset }

@@ -29,3 +29,3 @@ /* new StackTracey (Error) */

if (input instanceof Error) {
input = input.stack || '' }
input = input[StackTracey.stack] || input.stack || '' }

@@ -45,18 +45,27 @@ /* new StackTracey (string) */

static extractEntryMetadata (e) { const short = StackTracey.shortenPath (e.file)
static extractEntryMetadata (e) {
return O.assign (e, {
return StackTracey.updateEntryFilePath (O.assign (e, {
calleeShort: lastOf (e.callee.split ('.')),
fileName: lastOf (e.file .split ('/')),
fileShort: short,
thirdParty: StackTracey.isThirdParty (short) && !e.index })
fileName: lastOf (e.file .split ('/')) }))
}
static shortenPath (path) {
return path.replace (isBrowser ? window.location.href : (process.cwd () + '/'), '')
static updateEntryFilePath (e) { const short = StackTracey.shortenPath (e.file)
return O.assign (e, {
fileShort: short,
thirdParty: StackTracey.isThirdParty (short) && !e.index
})
}
static shortenPath (s) {
return s.replace (isBrowser ? window.location.href : (process.cwd () + '/'), '')
.replace (/^.*\:\/\/?\/?/, '')
}
static isThirdParty (shortPath) {
return shortPath.indexOf ('node_modules') === 0
return (shortPath[0] === '~') || // webpack-specific heuristic
(shortPath.indexOf ('node_modules') === 0) ||
(shortPath.indexOf ('webpack/bootstrap') === 0)
}

@@ -103,8 +112,12 @@

if (loc.sourceFile || (loc.file.indexOf ('<') >= 0)) { // skip things like <anonymous> and stuff that was already fetched
if (loc.sourceFile || (loc.file && loc.file.indexOf ('<') >= 0)) { // skip things like <anonymous> and stuff that was already fetched
return loc }
else {
const resolved = getSource (loc.file).resolve (loc)
let resolved = getSource (loc.file).resolve (loc)
if (resolved.sourceFile) {
resolved = StackTracey.updateEntryFilePath (O.assign (resolved, { file: resolved.sourceFile.path }))
}
if (resolved.sourceLine && resolved.sourceLine.includes ('// @hide')) {

@@ -155,2 +168,7 @@ resolved.sourceLine = resolved.sourceLine.replace ('// @hide', '')

/* A a private field that an Error instance can expose
------------------------------------------------------------------------ */
StackTracey.stack = (typeof Symbol !== 'undefined') ? Symbol.for ('StackTracey') : '__StackTracey'
/* ------------------------------------------------------------------------ */

@@ -157,0 +175,0 @@

@@ -83,5 +83,5 @@ "use strict";

clean.should.deep.equal ([
{ file: 'yo.js', line: 11, callee: 'a.funkktion', calleeShort: 'a' },
{ file: 'yo.js', line: 10, callee: 'foobar.boobar → foobar.boobar', calleeShort: 'foobar → foobar' },
{ file: 'lol.js', line: 10, callee: '', calleeShort: '' },
{ file: process.cwd () + '/yo.js', line: 11, callee: 'a.funkktion', calleeShort: 'a' },
{ file: process.cwd () + '/yo.js', line: 10, callee: 'foobar.boobar → foobar.boobar', calleeShort: 'foobar → foobar' },
{ file: process.cwd () + '/lol.js', line: 10, callee: '', calleeShort: '' },
])

@@ -109,2 +109,11 @@ })

})
it ('shortens path correctly', () => {
StackTracey.shortenPath ('webpack:///~/jquery/dist/jquery.js')
.should.equal ( '~/jquery/dist/jquery.js')
StackTracey.shortenPath ('webpack:/webpack/bootstrap')
.should.equal ( 'webpack/bootstrap')
})
})

@@ -111,0 +120,0 @@

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