@honeybadger-io/js 4.0.2 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,7 +17,7 @@ var url__default = /*#__PURE__*/_interopDefaultLegacy(url);
|
|
|
17
17
|
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
18
18
|
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/******************************************************************************
|
|
21
21
|
Copyright (c) Microsoft Corporation.
|
|
22
22
|
|
|
23
23
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -598,7 +598,7 @@ function isBrowserConfig(config) {
|
|
|
598
598
|
return config.async !== undefined;
|
|
599
599
|
}
|
|
600
600
|
|
|
601
|
-
var GlobalStore
|
|
601
|
+
var GlobalStore = /** @class */ (function () {
|
|
602
602
|
function GlobalStore(store) {
|
|
603
603
|
this.store = store;
|
|
604
604
|
}
|
|
@@ -619,7 +619,7 @@ var GlobalStore$1 = /** @class */ (function () {
|
|
|
619
619
|
var notifier = {
|
|
620
620
|
name: 'honeybadger-js',
|
|
621
621
|
url: 'https://github.com/honeybadger-io/honeybadger-js',
|
|
622
|
-
version: '4.0.
|
|
622
|
+
version: '4.0.5'
|
|
623
623
|
};
|
|
624
624
|
// Split at commas and spaces
|
|
625
625
|
var TAG_SEPARATOR = /,|\s+/;
|
|
@@ -635,7 +635,7 @@ var Client = /** @class */ (function () {
|
|
|
635
635
|
this.config = __assign({ apiKey: null, endpoint: 'https://api.honeybadger.io', environment: null, hostname: null, projectRoot: null, component: null, action: null, revision: null, reportData: null, breadcrumbsEnabled: true, maxBreadcrumbs: 40, maxObjectDepth: 8, logger: console, developmentEnvironments: ['dev', 'development', 'test'], debug: false, tags: null, enableUncaught: true, enableUnhandledRejection: true, afterUncaught: function () { return true; }, filters: ['creditcard', 'password'], __plugins: [] }, opts);
|
|
636
636
|
// First, we go with the global (shared) store.
|
|
637
637
|
// Webserver middleware can then switch to the AsyncStore for async context tracking.
|
|
638
|
-
this.__store = new GlobalStore
|
|
638
|
+
this.__store = new GlobalStore({ context: {}, breadcrumbs: [] });
|
|
639
639
|
this.__transport = transport;
|
|
640
640
|
this.logger = logger(this);
|
|
641
641
|
}
|
|
@@ -1033,9 +1033,7 @@ try {
|
|
|
1033
1033
|
Store = new AsyncLocalStorage();
|
|
1034
1034
|
}
|
|
1035
1035
|
catch (e) {
|
|
1036
|
-
|
|
1037
|
-
var GlobalStore = require('../core/store').GlobalStore;
|
|
1038
|
-
Store = new GlobalStore();
|
|
1036
|
+
Store = new GlobalStore({ context: {}, breadcrumbs: [] });
|
|
1039
1037
|
}
|
|
1040
1038
|
var AsyncStore = Store;
|
|
1041
1039
|
|
|
@@ -1220,7 +1218,7 @@ var ServerTransport = /** @class */ (function () {
|
|
|
1220
1218
|
}
|
|
1221
1219
|
ServerTransport.prototype.send = function (options, payload) {
|
|
1222
1220
|
var _this = this;
|
|
1223
|
-
var
|
|
1221
|
+
var _a = new url.URL(options.endpoint), protocol = _a.protocol, hostname = _a.hostname, pathname = _a.pathname;
|
|
1224
1222
|
var transport = (protocol === 'http:' ? http__default["default"] : https__default["default"]);
|
|
1225
1223
|
return new Promise(function (resolve, reject) {
|
|
1226
1224
|
var promise;
|
|
@@ -1233,16 +1231,22 @@ var ServerTransport = /** @class */ (function () {
|
|
|
1233
1231
|
promise = Promise.resolve();
|
|
1234
1232
|
}
|
|
1235
1233
|
promise.then(function () {
|
|
1234
|
+
//
|
|
1235
|
+
// We use a httpOptions object to limit issues with libraries that may patch Node.js
|
|
1236
|
+
// See https://github.com/honeybadger-io/honeybadger-js/issues/825#issuecomment-1193113433
|
|
1236
1237
|
var httpOptions = {
|
|
1237
1238
|
method: options.method,
|
|
1238
1239
|
headers: options.headers,
|
|
1240
|
+
path: pathname,
|
|
1241
|
+
protocol: protocol,
|
|
1242
|
+
hostname: hostname,
|
|
1239
1243
|
};
|
|
1240
1244
|
var data = undefined;
|
|
1241
1245
|
if (payload) {
|
|
1242
1246
|
data = Buffer.from(JSON.stringify(sanitize(payload, options.maxObjectDepth)), 'utf8');
|
|
1243
1247
|
httpOptions.headers['Content-Length'] = data.length;
|
|
1244
1248
|
}
|
|
1245
|
-
var req = transport.request(
|
|
1249
|
+
var req = transport.request(httpOptions, function (res) {
|
|
1246
1250
|
options.logger.debug("statusCode: ".concat(res.statusCode));
|
|
1247
1251
|
var body = '';
|
|
1248
1252
|
res.on('data', function (chunk) {
|
|
@@ -1276,18 +1280,21 @@ var Honeybadger = /** @class */ (function (_super) {
|
|
|
1276
1280
|
__extends(Honeybadger, _super);
|
|
1277
1281
|
function Honeybadger(opts) {
|
|
1278
1282
|
if (opts === void 0) { opts = {}; }
|
|
1283
|
+
var _this = this;
|
|
1279
1284
|
var _a;
|
|
1280
|
-
|
|
1285
|
+
_this = _super.call(this, __assign({ afterUncaught: fatallyLogAndExit, projectRoot: process.cwd(), hostname: os__default["default"].hostname() }, opts), new ServerTransport()) || this;
|
|
1281
1286
|
/** @internal */
|
|
1282
1287
|
_this.__beforeNotifyHandlers = [
|
|
1283
1288
|
function (notice) {
|
|
1284
|
-
notice.backtrace
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1289
|
+
if (notice && notice.backtrace) {
|
|
1290
|
+
notice.backtrace.forEach(function (line) {
|
|
1291
|
+
if (line.file) {
|
|
1292
|
+
line.file = line.file.replace(/.*\/node_modules\/(.+)/, '[NODE_MODULES]/$1');
|
|
1293
|
+
line.file = line.file.replace(notice.projectRoot, '[PROJECT_ROOT]');
|
|
1294
|
+
}
|
|
1295
|
+
return line;
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1291
1298
|
}
|
|
1292
1299
|
];
|
|
1293
1300
|
// serverless defaults
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/js",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/honeybadger-io/honeybadger-js",
|
|
6
6
|
"author": {
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"stacktrace-parser": "^0.1.10"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@commitlint/cli": "^
|
|
49
|
-
"@commitlint/config-conventional": "^
|
|
50
|
-
"@rollup/plugin-node-resolve": "^13.0
|
|
48
|
+
"@commitlint/cli": "^17.0.0",
|
|
49
|
+
"@commitlint/config-conventional": "^17.0.0",
|
|
50
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
51
51
|
"@rollup/plugin-replace": "^4.0.0",
|
|
52
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
52
|
+
"@rollup/plugin-typescript": "^8.3.3",
|
|
53
53
|
"@types/aws-lambda": "^8.10.89",
|
|
54
54
|
"@types/express": "^4.17.13",
|
|
55
55
|
"@types/jest": "^27.0.3",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"husky": "^8.0.1",
|
|
67
67
|
"jest": "^27.4.4",
|
|
68
68
|
"nock": "^13.2.1",
|
|
69
|
-
"rollup": "^2.
|
|
70
|
-
"rollup-plugin-
|
|
69
|
+
"rollup": "^2.75.6",
|
|
70
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
71
71
|
"shipjs": "0.24.4",
|
|
72
72
|
"sinon": "^14.0.0",
|
|
73
73
|
"supertest": "^6.1.6",
|
|
74
|
-
"ts-jest": "^
|
|
75
|
-
"tsd": "^0.
|
|
74
|
+
"ts-jest": "^27.1.5",
|
|
75
|
+
"tsd": "^0.21.0",
|
|
76
76
|
"tslib": "^2.3.1",
|
|
77
77
|
"typescript": "^4.5.3"
|
|
78
78
|
},
|