Comparing version 2.0.2 to 2.1.0
@@ -0,1 +1,6 @@ | ||
# 2.1.0 - 6/20/2017 | ||
- Truncate long lines in surrounding source to avoid sending large amounts of minified code [See #329] | ||
- Refactor automatic breadcrumb instrumentation of modules to accommodate compilation tools [See #322] | ||
- Testing for Node 8 [See #328] | ||
# 2.0.2 - 5/24/2017 | ||
@@ -2,0 +7,0 @@ - Fix issue with sending empty request details when no request is present [See #324] |
@@ -12,4 +12,5 @@ 'use strict'; | ||
var domain = require('domain'); | ||
var autoBreadcrumbs = require('./breadcrumbs'); | ||
var instrumentor = require('./instrumentation/instrumentor'); | ||
var extend = utils.extend; | ||
@@ -55,22 +56,5 @@ | ||
// autoBreadcrumbs: { http: true } enables a single type | ||
// this procedure will ensure that this.autoBreadcrumbs is an object populated | ||
// with keys -> bools reflecting actual status of all breadcrumb types | ||
var autoBreadcrumbDefaults = { | ||
console: false, | ||
http: false, | ||
}; | ||
this.autoBreadcrumbs = options.autoBreadcrumbs || false; | ||
// default to 30, don't allow higher than 100 | ||
this.maxBreadcrumbs = Math.max(0, Math.min(options.maxBreadcrumbs || 30, 100)); | ||
this.autoBreadcrumbs = extend({}, autoBreadcrumbDefaults); | ||
if (typeof options.autoBreadcrumbs !== 'undefined') { | ||
for (var key in autoBreadcrumbDefaults) { | ||
if (autoBreadcrumbDefaults.hasOwnProperty(key)) { | ||
if (typeof options.autoBreadcrumbs === 'boolean') { | ||
this.autoBreadcrumbs[key] = options.autoBreadcrumbs; | ||
} else if (typeof options.autoBreadcrumbs[key] === 'boolean') { | ||
this.autoBreadcrumbs[key] = options.autoBreadcrumbs[key]; | ||
} | ||
} | ||
} | ||
} | ||
@@ -135,7 +119,3 @@ this.captureUnhandledRejections = options.captureUnhandledRejections; | ||
for (var key in this.autoBreadcrumbs) { | ||
if (this.autoBreadcrumbs.hasOwnProperty(key)) { | ||
this.autoBreadcrumbs[key] && autoBreadcrumbs.instrument(key, this); | ||
} | ||
} | ||
instrumentor.instrument(this, this.autoBreadcrumbs); | ||
@@ -150,3 +130,3 @@ this.installed = true; | ||
autoBreadcrumbs.restoreOriginals(); | ||
instrumentor.deinstrument(this); | ||
@@ -505,3 +485,2 @@ // todo: this works for tests for now, but isn't what we ultimately want to be doing | ||
}, breadcrumb); | ||
var currCtx = this.getContext(); | ||
@@ -513,3 +492,2 @@ if (!currCtx.breadcrumbs) currCtx.breadcrumbs = []; | ||
} | ||
this.setContext(currCtx); | ||
@@ -516,0 +494,0 @@ } |
@@ -104,2 +104,9 @@ 'use strict'; | ||
module.exports.fill = function (obj, name, replacement, track) { | ||
var orig = obj[name]; | ||
obj[name] = replacement(orig); | ||
if (track) { | ||
track.push([obj, name, orig]); | ||
} | ||
}; | ||
@@ -159,2 +166,26 @@ var LINES_OF_CONTEXT = 7; | ||
// This is basically just `trim_line` from https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67 | ||
function snipLine(line, colno) { | ||
var ll = line.length; | ||
if (ll <= 150) return line; | ||
if (colno > ll) colno = ll; | ||
var start = Math.max(colno - 60, 0); | ||
if (start < 5) start = 0; | ||
var end = Math.min(start + 140, ll); | ||
if (end > ll - 5) end = ll; | ||
if (end === ll) start = Math.max(end - 140, 0); | ||
line = line.slice(start, end); | ||
if (start > 0) line = '{snip} ' + line; | ||
if (end < ll) line += ' {snip}'; | ||
return line; | ||
} | ||
function snipLine0(line) { | ||
return snipLine(line, 0); | ||
} | ||
function parseStack(err, cb) { | ||
@@ -206,5 +237,5 @@ if (!err) return cb([]); | ||
try { | ||
frame.pre_context = lines.slice(Math.max(0, frame.lineno - (LINES_OF_CONTEXT + 1)), frame.lineno - 1); | ||
frame.context_line = lines[frame.lineno - 1]; | ||
frame.post_context = lines.slice(frame.lineno, frame.lineno + LINES_OF_CONTEXT); | ||
frame.pre_context = lines.slice(Math.max(0, frame.lineno - (LINES_OF_CONTEXT + 1)), frame.lineno - 1).map(snipLine0); | ||
frame.context_line = snipLine(lines[frame.lineno - 1], frame.colno); | ||
frame.post_context = lines.slice(frame.lineno, frame.lineno + LINES_OF_CONTEXT).map(snipLine0); | ||
} catch (e) { | ||
@@ -211,0 +242,0 @@ // anomaly, being defensive in case |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"repository": "git://github.com/getsentry/raven-node.git", | ||
@@ -15,0 +15,0 @@ "author": "Matt Robenolt <matt@ydekproductions.com>", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
52558
14
1020
9
4