@honeybadger-io/js 4.0.1 → 4.0.4

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$1 = /** @class */ (function () {
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.1'
622
+ version: '4.0.4'
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$1({ context: {}, breadcrumbs: [] });
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
- // eslint-disable-next-line @typescript-eslint/no-var-requires
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
 
@@ -1276,18 +1274,21 @@ var Honeybadger = /** @class */ (function (_super) {
1276
1274
  __extends(Honeybadger, _super);
1277
1275
  function Honeybadger(opts) {
1278
1276
  if (opts === void 0) { opts = {}; }
1277
+ var _this = this;
1279
1278
  var _a;
1280
- var _this = _super.call(this, __assign({ afterUncaught: fatallyLogAndExit, projectRoot: process.cwd(), hostname: os__default["default"].hostname() }, opts), new ServerTransport()) || this;
1279
+ _this = _super.call(this, __assign({ afterUncaught: fatallyLogAndExit, projectRoot: process.cwd(), hostname: os__default["default"].hostname() }, opts), new ServerTransport()) || this;
1281
1280
  /** @internal */
1282
1281
  _this.__beforeNotifyHandlers = [
1283
1282
  function (notice) {
1284
- notice.backtrace.forEach(function (line) {
1285
- if (line.file) {
1286
- line.file = line.file.replace(/.*\/node_modules\/(.+)/, '[NODE_MODULES]/$1');
1287
- line.file = line.file.replace(notice.projectRoot, '[PROJECT_ROOT]');
1288
- }
1289
- return line;
1290
- });
1283
+ if (notice && notice.backtrace) {
1284
+ notice.backtrace.forEach(function (line) {
1285
+ if (line.file) {
1286
+ line.file = line.file.replace(/.*\/node_modules\/(.+)/, '[NODE_MODULES]/$1');
1287
+ line.file = line.file.replace(notice.projectRoot, '[PROJECT_ROOT]');
1288
+ }
1289
+ return line;
1290
+ });
1291
+ }
1291
1292
  }
1292
1293
  ];
1293
1294
  // serverless defaults
@@ -1301,6 +1302,7 @@ var Honeybadger = /** @class */ (function (_super) {
1301
1302
  return _this;
1302
1303
  }
1303
1304
  Honeybadger.prototype.factory = function (opts) {
1305
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1304
1306
  return new Honeybadger(opts);
1305
1307
  };
1306
1308
  Honeybadger.prototype.configure = function (opts) {
@@ -3,9 +3,9 @@ import { BrowserConfig } from './core/types';
3
3
  declare class Honeybadger extends Client {
4
4
  config: BrowserConfig;
5
5
  constructor(opts?: Partial<BrowserConfig>);
6
- configure(opts?: Partial<BrowserConfig>): Client;
6
+ configure(opts?: Partial<BrowserConfig>): this;
7
7
  resetMaxErrors(): number;
8
- factory(opts?: Partial<BrowserConfig>): Honeybadger;
8
+ factory(opts?: Partial<BrowserConfig>): this;
9
9
  checkIn(_id: string): Promise<void>;
10
10
  }
11
11
  declare const _default: Honeybadger;
@@ -12,10 +12,10 @@ export default abstract class Client {
12
12
  config: Config;
13
13
  logger: Logger;
14
14
  protected constructor(opts: Partial<Config>, transport: Transport);
15
- protected abstract factory(opts: Partial<Config>): void;
15
+ protected abstract factory(opts: Partial<Config>): this;
16
16
  protected abstract checkIn(id: string): Promise<void>;
17
17
  getVersion(): string;
18
- configure(opts?: Partial<Config>): Client;
18
+ configure(opts?: Partial<Config>): this;
19
19
  beforeNotify(handler: BeforeNotifyHandler): Client;
20
20
  afterNotify(handler: AfterNotifyHandler): Client;
21
21
  setContext(context: Record<string, unknown>): Client;
@@ -8,8 +8,8 @@ declare class Honeybadger extends Client {
8
8
  lambdaHandler: typeof lambdaHandler;
9
9
  config: Config | ServerlessConfig;
10
10
  constructor(opts?: Partial<Config | ServerlessConfig>);
11
- factory(opts?: Partial<Config | ServerlessConfig>): Honeybadger;
12
- configure(opts?: Partial<Config | ServerlessConfig>): Honeybadger;
11
+ factory(opts?: Partial<Config | ServerlessConfig>): this;
12
+ configure(opts?: Partial<Config | ServerlessConfig>): this;
13
13
  checkIn(id: string): Promise<void>;
14
14
  withRequest<R>(request: Record<symbol, unknown>, handler: (...args: never[]) => R, onError?: (...args: unknown[]) => unknown): R | void;
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honeybadger-io/js",
3
- "version": "4.0.1",
3
+ "version": "4.0.4",
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": "^16.2.3",
49
- "@commitlint/config-conventional": "^16.2.1",
50
- "@rollup/plugin-node-resolve": "^13.0.6",
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.0",
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",
@@ -63,16 +63,16 @@
63
63
  "eslint-plugin-jest": "^26.0.0",
64
64
  "eslint-plugin-promise": "^6.0.0",
65
65
  "express": "^4.17.1",
66
- "husky": "^7.0.4",
66
+ "husky": "^8.0.1",
67
67
  "jest": "^27.4.4",
68
68
  "nock": "^13.2.1",
69
- "rollup": "^2.61.1",
70
- "rollup-plugin-uglify": "^6.0.2",
69
+ "rollup": "^2.75.6",
70
+ "rollup-plugin-terser": "^7.0.2",
71
71
  "shipjs": "0.24.4",
72
- "sinon": "^13.0.1",
72
+ "sinon": "^14.0.0",
73
73
  "supertest": "^6.1.6",
74
- "ts-jest": "^27.1.1",
75
- "tsd": "^0.20.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
  },