Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@honeybadger-io/js

Package Overview
Dependencies
Maintainers
6
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@honeybadger-io/js - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

dist/browser/types/browser.d.ts

5

CHANGELOG.md

@@ -9,2 +9,7 @@ # Changelog

## [3.2.2] - 2021-07-19
### Fixed
- TypeScript: Add missing methods typedefs (#611)
- Internal: Fixed TypeScript types, added null checks, automated type declaration files
## [3.2.1] - 2021-05-17

@@ -11,0 +16,0 @@ ### Fixed

118

dist/browser/honeybadger.d.ts

@@ -1,107 +0,15 @@

// Type definitions for honeybadger.js
// Project: https://github.com/honeybadger-io/honeybadger-js
import { NextFunction, Request, Response } from 'express'
declare class Honeybadger {
public factory(opts?: Partial<Honeybadger.Config>): Honeybadger
public notify(notice: Error | string | Partial<Honeybadger.Notice>, name?: string | Partial<Honeybadger.Notice>, extra?: string | Partial<Honeybadger.Notice>): Honeybadger.Notice | false
public configure(opts: Partial<Honeybadger.Config>): Honeybadger
public beforeNotify(func: Honeybadger.BeforeNotifyHandler): Honeybadger
public afterNotify(func: Honeybadger.AfterNotifyHandler): Honeybadger
public setContext(context: Record<string, unknown>): Honeybadger
public resetContext(context?: Record<string, unknown>): Honeybadger
public addBreadcrumb(message: string, opts?: Partial<Honeybadger.BreadcrumbRecord>): Honeybadger
// Server middleware
public requestHandler(req: Request, res: Response, next: NextFunction): void
public errorHandler(err: any, req: Request, _res: Response, next: NextFunction): unknown
public lambdaHandler(handler: any): (event: any, context: any, callback: any) => void
import Client from './types/core/client';
import { Config } from './types/core/types';
interface BrowserConfig extends Config {
async: boolean;
maxErrors: number;
}
declare namespace Honeybadger {
interface Logger {
log(...args: unknown[]): unknown
info(...args: unknown[]): unknown
debug(...args: unknown[]): unknown
warn(...args: unknown[]): unknown
error(...args: unknown[]): unknown
}
interface Config {
apiKey: string | undefined
endpoint: string,
developmentEnvironments: string[]
environment: string | undefined
hostname: string | undefined
projectRoot: string | undefined
component: string | undefined
action: string | undefined
revision: string | undefined
disabled: boolean
debug: boolean
reportData: boolean
breadcrumbsEnabled: boolean | Partial<{ dom: boolean, network: boolean, navigation: boolean, console: boolean }>
maxBreadcrumbs: number
maxObjectDepth: number
logger: Logger
enableUncaught: boolean
afterUncaught: (err: Error) => void
enableUnhandledRejection: boolean
tags: string | string[] | unknown
filters: string[]
[x: string]: unknown
// Browser
async: boolean
maxErrors: number
}
interface BeforeNotifyHandler {
(notice: Notice): boolean | void
}
interface AfterNotifyHandler {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(error: any, notice: Notice): boolean | void
}
interface Notice {
id: string | undefined,
name: string,
message: string,
stack: string,
backtrace: BacktraceFrame[],
fingerprint?: string | undefined,
url?: string | undefined,
component?: string | undefined,
action?: string | undefined,
context: Record<string, unknown>,
cgiData: Record<string, unknown>,
params: Record<string, unknown>,
session: Record<string, unknown>,
headers: Record<string, unknown>,
cookies: Record<string, unknown> | string,
projectRoot?: string | undefined,
environment?: string | undefined,
revision?: string | undefined,
afterNotify?: AfterNotifyHandler
tags: string | string[]
}
interface BacktraceFrame {
file: string,
method: string,
number: number,
column: number
}
interface BreadcrumbRecord {
category: string,
message: string,
metadata: Record<string, unknown>,
timestamp: string
}
declare class Honeybadger extends Client {
config: BrowserConfig;
constructor(opts?: Partial<BrowserConfig>);
configure(opts?: Partial<BrowserConfig>): Client;
resetMaxErrors(): number;
factory(opts?: Partial<BrowserConfig>): Honeybadger;
}
declare const singleton: Honeybadger
export = singleton
declare const _default: Honeybadger;
export default _default;

@@ -252,3 +252,3 @@ (function (global, factory) {

function newObject(obj) {
if (typeof (obj) !== 'object') {
if (typeof (obj) !== 'object' || obj === null) {
return {};

@@ -351,3 +351,2 @@ }

* properties as Error, but supports additional Honeybadger properties.)
* @param {!Object} notice
*/

@@ -487,3 +486,3 @@ function makeNotice(thing) {

}
var _a = url.split(/\?/, 2); _a[0]; var query = _a[1];
var query = url.split(/\?/, 2)[1];
if (!query) {

@@ -514,3 +513,3 @@ return url;

url: 'https://github.com/honeybadger-io/honeybadger-js',
version: '3.2.1'
version: '3.2.2'
};

@@ -528,6 +527,11 @@ // Split at commas

if (opts === void 0) { opts = {}; }
/** @internal */
this.__pluginsExecuted = false;
/** @internal */
this.__context = {};
/** @internal */
this.__breadcrumbs = [];
/** @internal */
this.__beforeNotifyHandlers = [];
/** @internal */
this.__afterNotifyHandlers = [];

@@ -571,3 +575,3 @@ 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'], disabled: false, debug: false, tags: null, enableUncaught: true, enableUnhandledRejection: true, afterUncaught: function () { return true; }, filters: ['creditcard', 'password'], __plugins: [] }, opts);

this.logger.warn('Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.');
if (typeof context === 'object') {
if (typeof context === 'object' && context !== null) {
this.__context = merge({}, context);

@@ -608,3 +612,3 @@ }

}
if (typeof extra === 'object') {
if (typeof extra === 'object' && extra !== null) {
notice = mergeNotice(notice, extra);

@@ -671,2 +675,3 @@ }

};
/** @internal */
Client.prototype.__reportData = function () {

@@ -678,5 +683,7 @@ if (this.config.reportData !== null) {

};
/** @internal */
Client.prototype.__send = function (_notice) {
throw (new Error('Must implement send in subclass'));
};
/** @internal */
Client.prototype.__buildPayload = function (notice) {

@@ -716,2 +723,3 @@ var headers = filter(notice.headers, this.config.filters) || {};

};
/** @internal */
Client.prototype.__constructTags = function (tags) {

@@ -959,3 +967,3 @@ if (!tags) {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function onUnhandlerRejection (_window) {
function onUnhandledRejection (_window) {
if (_window === void 0) { _window = window; }

@@ -1338,4 +1346,7 @@ return {

var _this = _super.call(this, __assign({ async: true, maxErrors: null, projectRoot: window.location.protocol + '//' + window.location.host }, opts)) || this;
/** @internal */
_this.__errorsSent = 0;
/** @internal */
_this.__lastWrapErr = undefined;
/** @internal */
_this.__beforeNotifyHandlers = [

@@ -1355,2 +1366,6 @@ function (notice) {

}
Honeybadger.prototype.configure = function (opts) {
if (opts === void 0) { opts = {}; }
return _super.prototype.configure.call(this, opts);
};
Honeybadger.prototype.resetMaxErrors = function () {

@@ -1362,2 +1377,3 @@ return (this.__errorsSent = 0);

};
/** @internal */
Honeybadger.prototype.__buildPayload = function (notice) {

@@ -1387,2 +1403,3 @@ var cgiData = {

};
/** @internal */
Honeybadger.prototype.__send = function (notice) {

@@ -1421,5 +1438,7 @@ var _this = this;

};
// wrap always returns the same function so that callbacks can be removed via
// removeEventListener.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
/**
* wrap always returns the same function so that callbacks can be removed via
* removeEventListener.
* @internal
*/
Honeybadger.prototype.__wrap = function (f, opts) {

@@ -1485,5 +1504,7 @@ if (opts === void 0) { opts = {}; }

};
/** @internal */
Honeybadger.prototype.__incrementErrorsCount = function () {
return this.__errorsSent++;
};
/** @internal */
Honeybadger.prototype.__exceedsMaxErrors = function () {

@@ -1497,3 +1518,3 @@ return this.config.maxErrors && this.__errorsSent >= this.config.maxErrors;

onError(),
onUnhandlerRejection(),
onUnhandledRejection(),
timers(),

@@ -1500,0 +1521,0 @@ eventListeners(),

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Honeybadger=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o="<unknown>";function i(t){return t.split("\n").reduce(function(t,e){e=function(t){var e=a.exec(t);if(!e)return null;var n=e[2]&&0===e[2].indexOf("native"),r=e[2]&&0===e[2].indexOf("eval"),t=c.exec(e[2]);r&&null!=t&&(e[2]=t[1],e[3]=t[2],e[4]=t[3]);return{file:n?null:e[2],methodName:e[1]||o,arguments:n?[e[2]]:[],lineNumber:e[3]?+e[3]:null,column:e[4]?+e[4]:null}}(e)||function(t){t=s.exec(t);return t?{file:t[2],methodName:t[1]||o,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}(e)||function(t){var e=u.exec(t);if(!e)return null;var n=e[3]&&-1<e[3].indexOf(" > eval"),t=l.exec(e[3]);n&&null!=t&&(e[3]=t[1],e[4]=t[2],e[5]=null);return{file:e[3],methodName:e[1]||o,arguments:e[2]?e[2].split(","):[],lineNumber:e[4]?+e[4]:null,column:e[5]?+e[5]:null}}(e)||function(t){t=d.exec(t);return t?{file:t[2],methodName:t[1]||o,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}(e)||function(t){t=f.exec(t);return t?{file:t[3],methodName:t[1]||o,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}(e);return e&&t.push(e),t},[])}var a=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/;var s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var u=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,l=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var f=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var d=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function p(t,e){var n,r={};for(n in t)r[n]=t[n];for(n in e)r[n]=e[n];return r}function h(t,e){var n=p(t,e);return t.context&&e.context&&(n.context=p(t.context,e.context)),n}function g(t,e,n){void 0===n&&(n=void 0);for(var r=0,o=e.length;r<o;r++)e[r](n,t);return 1}function m(t){if("object"!=typeof t)return{};var e,n={};for(e in t)n[e]=t[e];return n}function y(t,c){void 0===c&&(c=8);var s=[];return function e(t,n){if(void 0===n&&(n=0),c<=n)return"[DEPTH]";if(/function|symbol/.test(typeof(r=t))||null===r||"object"==typeof r&&void 0===r.hasOwnProperty)return Object.prototype.toString.call(t);var r;if(function(t){if(t&&"object"==typeof t){for(var e=0;e<s.length;e++)if(s[e]===t)return 1;s.push(t)}}(t))return"[RECURSION]";if(Array.isArray(t))return t.map(function(t){return e(t,n+1)});if("object"!=typeof t)return t;var o,i={};for(o in t){var a=t[o];Object.prototype.hasOwnProperty.call(t,o)&&null!=o&&null!=a&&(i[o]=e(a,n+1))}return i}(t)}function e(o){function t(r){return function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];"debug"===r&&!o.config.debug||(e.unshift("[Honeybadger]"),(t=o.config.logger)[r].apply(t,e))}}return{log:t("log"),info:t("info"),debug:t("debug"),warn:t("warn"),error:t("error")}}function b(t){return t?"[object Error]"===Object.prototype.toString.call(t)?p(t,{name:t.name,message:t.message,stack:t.stack}):"object"==typeof t?m(t):{message:String(t)}:{}}function _(t,e,n){if(t&&e&&n&&e in t){for(var r=t[e];r&&r.__hb_original;)r=r.__hb_original;try{t[e]=n(r),t[e].__hb_original=r}catch(t){}}}function v(t,o){if(E("Object",t)){E("Array",o)||(o=[]);var i=[];return function t(e){var n,r;if(E("Object",e)||E("Array",e)){if(-1!==i.indexOf(e))return"[CIRCULAR DATA STRUCTURE]";i.push(e)}if(E("Object",e)){for(n in r={},e)w(n,o)?r[n]="[FILTERED]":r[n]=t(e[n]);return r}return E("Array",e)?e.map(t):E("Function",e)?"[FUNC]":e}(t)}}function w(t,e){for(var n=0;n<e.length;n++)if(-1!==t.toLowerCase().indexOf(e[n].toLowerCase()))return 1}function E(t,e){var n=Object.prototype.toString.call(e).slice(8,-1);return null!=e&&n===t}var x={name:"honeybadger-js",url:"https://github.com/honeybadger-io/honeybadger-js",version:"3.2.1"},j=/,/,k=/[^\w]/g,T=/\S/,t=(O.prototype.factory=function(t){throw new Error("Must implement __factory in subclass")},O.prototype.getVersion=function(){return x.version},O.prototype.configure=function(t){var e,n=this;for(e in void 0===t&&(t={}),t)this.config[e]=t[e];return this.__pluginsExecuted||(this.__pluginsExecuted=!0,this.config.__plugins.forEach(function(t){return t.load(n)})),this},O.prototype.beforeNotify=function(t){return this.__beforeNotifyHandlers.push(t),this},O.prototype.afterNotify=function(t){return this.__afterNotifyHandlers.push(t),this},O.prototype.setContext=function(t){return"object"==typeof t&&(this.__context=p(this.__context,t)),this},O.prototype.resetContext=function(t){return this.logger.warn("Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead."),this.__context="object"==typeof t?p({},t):{},this},O.prototype.clear=function(){return this.__context={},this.__breadcrumbs=[],this},O.prototype.notify=function(t,e,n){if(void 0===e&&(e=void 0),void 0===n&&(n=void 0),!this.config.apiKey)return this.logger.warn("Unable to send error report: no API key has been configured"),!1;if(this.config.disabled)return this.logger.warn("Deprecation warning: instead of `disabled: true`, use `reportData: false` to explicitly disable Honeybadger reporting. (Dropping notice: honeybadger.js is disabled)"),!1;if(!this.__reportData())return this.logger.debug("Dropping notice: honeybadger.js is in development mode"),!1;if(t=b(t),e&&"object"!=typeof e&&(e={name:String(e)}),e&&(t=h(t,e)),"object"==typeof n&&(t=h(t,n)),function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return;return 1}(t))return!1;var r=this.__constructTags(t.tags),e=this.__constructTags(this.__context.tags),n=this.__constructTags(this.config.tags),o=r.concat(e).concat(n),e=o.filter(function(t,e){return o.indexOf(t)===e}),n=0;return"string"==typeof(t=p(t,{name:t.name||"Error",context:p(this.__context,t.context),projectRoot:t.projectRoot||this.config.projectRoot,environment:t.environment||this.config.environment,component:t.component||this.config.component,action:t.action||this.config.action,revision:t.revision||this.config.revision,tags:e})).stack&&t.stack.trim()||(t.stack=function(){try{throw new Error("")}catch(t){if(t.stack)return t.stack}for(var t=[],e=arguments.callee;e&&t.length<10;){/function(?:\s+([\w$]+))+\s*\(/.test(e.toString())?t.push(RegExp.$1||"<anonymous>"):t.push("<anonymous>");try{e=e.caller}catch(t){break}}return t.join("\n")}(),n=2),t.backtrace=function(t,e){void 0===e&&(e=0);try{var n=i(t).map(function(t){return{file:t.file,method:t.methodName,number:t.lineNumber,column:t.column}});return n.splice(0,e),n}catch(t){return[]}}(t.stack,n),!!function(t,e){for(var n=0,r=e.length;n<r;n++)if(!1===(0,e[n])(t))return;return 1}(t,this.__beforeNotifyHandlers)&&(this.addBreadcrumb("Honeybadger Notice",{category:"notice",metadata:{message:t.message,name:t.name,stack:t.stack}}),t.__breadcrumbs=this.config.breadcrumbsEnabled?this.__breadcrumbs.slice():[],this.__send(t))},O.prototype.addBreadcrumb=function(t,e){if(this.config.breadcrumbsEnabled){var n=m((e=e||{}).metadata),r=e.category||"custom",e=(new Date).toISOString();this.__breadcrumbs.push({category:r,message:t,metadata:n,timestamp:e});e=this.config.maxBreadcrumbs;return this.__breadcrumbs.length>e&&(this.__breadcrumbs=this.__breadcrumbs.slice(this.__breadcrumbs.length-e)),this}},O.prototype.__reportData=function(){return null!==this.config.reportData?this.config.reportData:!(this.config.environment&&this.config.developmentEnvironments.includes(this.config.environment))},O.prototype.__send=function(t){throw new Error("Must implement send in subclass")},O.prototype.__buildPayload=function(t){var e=v(t.headers,this.config.filters)||{},e=v(n(n({},t.cgiData),function(n,r){void 0===r&&(r="");var o={};return Object.keys(n).forEach(function(t){var e=r+t.replace(/\W/g,"_").toUpperCase();o[e]=n[t]}),o}(e,"HTTP_")),this.config.filters);return{notifier:x,breadcrumbs:{enabled:!!this.config.breadcrumbsEnabled,trail:t.__breadcrumbs||[]},error:{class:t.name,message:t.message,backtrace:t.backtrace,fingerprint:t.fingerprint,tags:t.tags},request:{url:function(t,n){if(!n)return t;if("string"!=typeof t)return t;var e=t.split(/\?/,2);if(e[0],!(e=e[1]))return t;var r=t;return e.split(/[&]\s?/).forEach(function(t){var e=t.split("=",2),t=e[0],e=e[1];w(t,n)&&(r=r.replace(t+"="+e,t+"=[FILTERED]"))}),r}(t.url,this.config.filters),component:t.component,action:t.action,context:t.context,cgi_data:e,params:v(t.params,this.config.filters)||{},session:v(t.session,this.config.filters)||{}},server:{project_root:t.projectRoot,environment_name:t.environment,revision:t.revision,hostname:this.config.hostname,time:(new Date).toUTCString()}}},O.prototype.__constructTags=function(t){return t?t.toString().split(j).map(function(t){return t.replace(k,"")}).filter(function(t){return T.test(t)}):[]},O);function O(t){void 0===t&&(t={}),this.__pluginsExecuted=!1,this.__context={},this.__breadcrumbs=[],this.__beforeNotifyHandlers=[],this.__afterNotifyHandlers=[],this.config=n({apiKey:null,endpoint:"https://api.honeybadger.io",environment:null,hostname:null,projectRoot:null,component:null,action:null,revision:null,reportData:null,breadcrumbsEnabled:!0,maxBreadcrumbs:40,maxObjectDepth:8,logger:console,developmentEnvironments:["dev","development","test"],disabled:!1,debug:!1,tags:null,enableUncaught:!0,enableUnhandledRejection:!0,afterUncaught:function(){return!0},filters:["creditcard","password"],__plugins:[]},t),this.logger=e(this)}function N(n){if(!n||!n.tagName)return"";var r=n.tagName.toLowerCase();if("html"===r)return"";n.id&&(r+="#"+n.id);var t=n.getAttribute("class");t&&t.split(/\s+/).forEach(function(t){r+="."+t}),["alt","name","title","type"].forEach(function(t){var e=n.getAttribute(t);e&&(r+="["+t+'="'+e+'"]')});t=function(e){try{var t=e.parentNode.childNodes,n=[];return Array.prototype.forEach.call(t,function(t){t.tagName&&t.tagName===e.tagName&&n.push(t)}),n}catch(t){return[]}}(n);return 1<t.length&&(r+=":nth-child("+(Array.prototype.indexOf.call(t,n)+1)+")"),r}function R(t){var e=t.textContent||t.innerText||"";return e||"submit"!==t.type&&"button"!==t.type||(e=t.value),function(t,e){t.length>e&&(t=t.substr(0,e)+"...");return t}(e.trim(),300)}function S(t){return-1!==t.toString().indexOf("native")}function H(t){t=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/)||{};return{protocol:t[2],host:t[4],pathname:t[5]}}function C(t){var e=H(t),t=H(document.URL);return!e.host||!e.protocol||e.protocol===t.protocol&&e.host===t.host?e.pathname:e.protocol+"://"+e.host+e.pathname}var U,P,A,D,L,q,I,B=function(){var t=!0;if(window.atob||(t=!1),window.ErrorEvent)try{0===new window.ErrorEvent("").colno&&(t=!1)}catch(t){}return t}(),M=0;function W(t){void 0===t&&(t={});var e=P.call(this,n({async:!0,maxErrors:null,projectRoot:window.location.protocol+"//"+window.location.host},t))||this;return e.__errorsSent=0,e.__lastWrapErr=void 0,e.__beforeNotifyHandlers=[function(t){return e.__exceedsMaxErrors()?(e.logger.debug("Dropping notice: max errors exceeded",t),!1):(t.url||(t.url=document.URL),!0)}],e}return new(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(W,P=t),W.prototype.resetMaxErrors=function(){return this.__errorsSent=0},W.prototype.factory=function(t){return new W(t)},W.prototype.__buildPayload=function(t){var e,n,r={HTTP_USER_AGENT:void 0,HTTP_REFERER:void 0,HTTP_COOKIE:void 0};r.HTTP_USER_AGENT=navigator.userAgent,document.referrer.match(/\S/)&&(r.HTTP_REFERER=document.referrer),(e="string"==typeof t.cookies?(e=t.cookies,n={},e.split(/[;,]\s?/).forEach(function(t){var e=t.split("=",2),t=e[0],e=e[1];n[t]=e}),n):t.cookies)&&(r.HTTP_COOKIE=function(t){if("object"==typeof t){var e,n=[];for(e in t)n.push(e+"="+t[e]);return n.join(";")}}(v(e,this.config.filters)));t=P.prototype.__buildPayload.call(this,t);return t.request.cgi_data=p(r,t.request.cgi_data),t},W.prototype.__send=function(e){var t=this;this.__incrementErrorsCount();var n,r,o=this.__buildPayload(e),i=Array.prototype.slice.call(this.__afterNotifyHandlers);e.afterNotify&&i.unshift(e.afterNotify);try{var a=new XMLHttpRequest;a.open("POST",(n=this.config,r="/v1/notices/js",n.endpoint.trim().replace(/\/$/,"")+"/"+(r=r.trim().replace(/(^\/|\/$)/g,""))),this.config.async),a.setRequestHeader("X-API-Key",this.config.apiKey),a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("Accept","text/json, application/json"),a.send(JSON.stringify(y(o,this.config.maxObjectDepth))),a.onload=function(){if(201!==a.status)return g(e,i,new Error("Bad HTTP response: "+a.status)),void t.logger.debug("Unable to send error report: "+a.status+": "+a.statusText,a,e);g(p(e,{id:JSON.parse(a.response).id}),i),t.logger.debug("Error report sent",e)}}catch(t){g(e,i,t),this.logger.error("Unable to send error report: error while initializing request",t,e)}return!0},W.prototype.__wrap=function(t,e){void 0===e&&(e={});var n,r,o=t;e=e||{};try{return"function"!=typeof o?o:(r=o,"function"!=typeof Object.isExtensible||Object.isExtensible(r)?(o.___hb||(n=this,o.___hb=function(){var t=n.config.enableUncaught;if(!e.catch&&!B&&t)return o.apply(this,arguments);try{return o.apply(this,arguments)}catch(t){if(n.__lastWrapErr===t)throw t;throw n.__lastWrapErr=t,M+=1,clearTimeout(U),U=setTimeout(function(){M=0}),n.addBreadcrumb(e.component?e.component+": "+t.name:t.name,{category:"error",metadata:{message:t.message,name:t.name,stack:t.stack}}),n.notify(t),t}}),o.___hb.___hb=o.___hb,o.___hb):o)}catch(t){return o}},W.prototype.__incrementErrorsCount=function(){return this.__errorsSent++},W.prototype.__exceedsMaxErrors=function(){return this.config.maxErrors&&this.__errorsSent>=this.config.maxErrors},W)({__plugins:[(void 0===I&&(I=window),{load:function(a){_(I,"onerror",function(i){return function(t,e,n,r,o){return function(t,e,n,r,o){if(a.logger.debug("window.onerror callback invoked",arguments),0<M)return a.logger.debug("Ignoring window.onerror (error likely reported earlier)",arguments),--M;a.config.enableUncaught&&(0===n&&/Script error\.?/.test(t)?a.logger.info("Ignoring cross-domain script error: enable CORS to track these types of errors",arguments):((o=b(o)).name||(o.name="window.onerror"),o.message||(o.message=t),o.stack||(o.stack=[o.message,"\n at ? (",e||"unknown",":",n||0,":",r||0,")"].join("")),a.addBreadcrumb("window.onerror"!==o.name&&o.name?"window.onerror: "+o.name:"window.onerror",{category:"error",metadata:{name:o.name,message:o.message,stack:o.stack}}),a.notify(o)))}(t,e,n,r,o),"function"==typeof i&&i.apply(window,arguments)}})}}),(void 0===q&&(q=window),{load:function(r){r.config.enableUnhandledRejection&&_(q,"onunhandledrejection",function(e){return function(t){!function(t){if(r.logger.debug("window.onunhandledrejection callback invoked",arguments),r.config.enableUnhandledRejection){var e=t.reason;if(e instanceof Error){t=e.message+"\n at ? (unknown:0)",t=e.stack||t,t={name:e.name,message:"UnhandledPromiseRejectionWarning: "+e,stack:t};return r.addBreadcrumb("window.onunhandledrejection: "+t.name,{category:"error",metadata:t}),r.notify(t)}var n="string"==typeof e?e:null!==(n=JSON.stringify(e))&&void 0!==n?n:"Unspecified reason";r.notify({name:"window.onunhandledrejection",message:"UnhandledPromiseRejectionWarning: "+n})}}(t),"function"==typeof e&&e.apply(this,arguments)}})}}),(void 0===L&&(L=window),{load:function(i){function t(o){return function(r){return function(t,e){if("function"!=typeof t)return r(t,e);var n=Array.prototype.slice.call(arguments,2);return t=i.__wrap(t,o),r(function(){t.apply(void 0,n)},e)}}}_(L,"setTimeout",t({component:"setTimeout"})),_(L,"setInterval",t({component:"setInterval"}))}}),(void 0===D&&(D=window),{load:function(a){["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"].forEach(function(t){var e=D[t]&&D[t].prototype;e&&Object.prototype.hasOwnProperty.call(e,"addEventListener")&&(_(e,"addEventListener",function(o){var i={component:t+".prototype.addEventListener"};return function(t,e,n,r){try{e&&null!=e.handleEvent&&(e.handleEvent=a.__wrap(e.handleEvent,i))}catch(t){a.logger.error(t)}return o.call(this,t,a.__wrap(e,i),n,r)}}),_(e,"removeEventListener",function(o){return function(t,e,n,r){return o.call(this,t,e,n,r),o.call(this,t,a.__wrap(e),n,r)}}))})}}),(void 0===A&&(A=window),{load:function(a){function t(t){return!0===a.config.breadcrumbsEnabled||(t?!0===a.config.breadcrumbsEnabled[t]:!1!==a.config.breadcrumbsEnabled)}function n(t,e){r=e,a.addBreadcrumb("Page changed",{category:"navigation",metadata:{from:t,to:e}})}function e(e){return function(){var t=2<arguments.length?arguments[2]:void 0;return t&&n(r,String(t)),e.apply(this,arguments)}}var r;t("console")&&["debug","info","warn","error","log"].forEach(function(r){_(A.console,r,function(n){return function(){var t,e=Array.prototype.slice.call(arguments),t=(t=e,Array.isArray(t)?t.map(function(t){try{return String(t)}catch(t){return"[unknown]"}}).join(" "):""),e={category:"log",metadata:{level:r,arguments:y(e,3)}};a.addBreadcrumb(t,e),"function"==typeof n&&Function.prototype.apply.call(n,A.console,arguments)}})}),t("dom")&&A.addEventListener("click",function(t){var e,n,r;try{e=N(t.target),n=function t(e){var n=N(e);if(e.parentNode&&e.parentNode.tagName&&0<(e=t(e.parentNode)).length)return e+" > "+n;return n}(t.target),r=R(t.target)}catch(t){e="UI Click",r=n="[unknown]"}0!==e.length&&a.addBreadcrumb(e,{category:"ui.click",metadata:{selector:n,text:r,event:t}})},!0),t("network")&&(_(XMLHttpRequest.prototype,"open",function(r){return function(){var t=arguments[1],e="string"==typeof arguments[0]?arguments[0].toUpperCase():arguments[0],n=e+" "+C(t);this.__hb_xhr={type:"xhr",method:e,url:t,message:n},"function"==typeof r&&r.apply(this,arguments)}}),_(XMLHttpRequest.prototype,"send",function(t){return function(){var e=this;function n(){var t;4===e.readyState&&(t=void 0,e.__hb_xhr&&(e.__hb_xhr.status_code=e.status,t=e.__hb_xhr.message,delete e.__hb_xhr.message),a.addBreadcrumb(t||"XMLHttpRequest",{category:"request",metadata:e.__hb_xhr}))}"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?_(e,"onreadystatechange",function(t){return function(){n(),"function"==typeof t&&t.apply(this,arguments)}}):e.onreadystatechange=n,"function"==typeof t&&t.apply(e,arguments)}})),!t("network")||function(){if(window.fetch){if(S(window.fetch))return 1;try{var t=document.createElement("iframe");t.style.display="none",document.head.appendChild(t);var e=t.contentWindow.fetch&&S(t.contentWindow.fetch);return document.head.removeChild(t),e}catch(t){console&&console.warn&&console.warn("failed to detect native fetch via iframe: "+t)}}}()&&_(A,"fetch",function(i){return function(){var t,e=arguments[0],n="GET";"string"==typeof e?t=e:"Request"in A&&e instanceof Request?(t=e.url,e.method&&(n=e.method)):t=String(e),arguments[1]&&arguments[1].method&&(n=arguments[1].method),"string"==typeof n&&(n=n.toUpperCase());var r=n+" "+C(t),o={type:"fetch",method:n,url:t};return i.apply(this,arguments).then(function(t){return o.status_code=t.status,a.addBreadcrumb(r,{category:"request",metadata:o}),t}).catch(function(t){throw a.addBreadcrumb("fetch error",{category:"error",metadata:o}),t})}}),t("navigation")&&(r=A.location.href,_(A,"onpopstate",function(t){return function(){if(n(r,A.location.href),t)return t.apply(this,arguments)}}),_(A.history,"pushState",e),_(A.history,"replaceState",e))}})]})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Honeybadger=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o="<unknown>";function i(t){return t.split("\n").reduce(function(t,e){e=function(t){var e=a.exec(t);if(!e)return null;var n=e[2]&&0===e[2].indexOf("native"),r=e[2]&&0===e[2].indexOf("eval"),t=c.exec(e[2]);r&&null!=t&&(e[2]=t[1],e[3]=t[2],e[4]=t[3]);return{file:n?null:e[2],methodName:e[1]||o,arguments:n?[e[2]]:[],lineNumber:e[3]?+e[3]:null,column:e[4]?+e[4]:null}}(e)||function(t){t=s.exec(t);return t?{file:t[2],methodName:t[1]||o,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}(e)||function(t){var e=u.exec(t);if(!e)return null;var n=e[3]&&-1<e[3].indexOf(" > eval"),t=l.exec(e[3]);n&&null!=t&&(e[3]=t[1],e[4]=t[2],e[5]=null);return{file:e[3],methodName:e[1]||o,arguments:e[2]?e[2].split(","):[],lineNumber:e[4]?+e[4]:null,column:e[5]?+e[5]:null}}(e)||function(t){t=d.exec(t);return t?{file:t[2],methodName:t[1]||o,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}(e)||function(t){t=f.exec(t);return t?{file:t[3],methodName:t[1]||o,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}(e);return e&&t.push(e),t},[])}var a=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/;var s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var u=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,l=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var f=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var d=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function p(t,e){var n,r={};for(n in t)r[n]=t[n];for(n in e)r[n]=e[n];return r}function h(t,e){var n=p(t,e);return t.context&&e.context&&(n.context=p(t.context,e.context)),n}function g(t,e,n){void 0===n&&(n=void 0);for(var r=0,o=e.length;r<o;r++)e[r](n,t);return 1}function m(t){if("object"!=typeof t||null===t)return{};var e,n={};for(e in t)n[e]=t[e];return n}function y(t,c){void 0===c&&(c=8);var s=[];return function e(t,n){if(void 0===n&&(n=0),c<=n)return"[DEPTH]";if(/function|symbol/.test(typeof(r=t))||null===r||"object"==typeof r&&void 0===r.hasOwnProperty)return Object.prototype.toString.call(t);var r;if(function(t){if(t&&"object"==typeof t){for(var e=0;e<s.length;e++)if(s[e]===t)return 1;s.push(t)}}(t))return"[RECURSION]";if(Array.isArray(t))return t.map(function(t){return e(t,n+1)});if("object"!=typeof t)return t;var o,i={};for(o in t){var a=t[o];Object.prototype.hasOwnProperty.call(t,o)&&null!=o&&null!=a&&(i[o]=e(a,n+1))}return i}(t)}function e(o){function t(r){return function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];"debug"===r&&!o.config.debug||(e.unshift("[Honeybadger]"),(t=o.config.logger)[r].apply(t,e))}}return{log:t("log"),info:t("info"),debug:t("debug"),warn:t("warn"),error:t("error")}}function b(t){return t?"[object Error]"===Object.prototype.toString.call(t)?p(t,{name:t.name,message:t.message,stack:t.stack}):"object"==typeof t?m(t):{message:String(t)}:{}}function _(t,e,n){if(t&&e&&n&&e in t){for(var r=t[e];r&&r.__hb_original;)r=r.__hb_original;try{t[e]=n(r),t[e].__hb_original=r}catch(t){}}}function v(t,o){if(E("Object",t)){E("Array",o)||(o=[]);var i=[];return function t(e){var n,r;if(E("Object",e)||E("Array",e)){if(-1!==i.indexOf(e))return"[CIRCULAR DATA STRUCTURE]";i.push(e)}if(E("Object",e)){for(n in r={},e)w(n,o)?r[n]="[FILTERED]":r[n]=t(e[n]);return r}return E("Array",e)?e.map(t):E("Function",e)?"[FUNC]":e}(t)}}function w(t,e){for(var n=0;n<e.length;n++)if(-1!==t.toLowerCase().indexOf(e[n].toLowerCase()))return 1}function E(t,e){var n=Object.prototype.toString.call(e).slice(8,-1);return null!=e&&n===t}var x={name:"honeybadger-js",url:"https://github.com/honeybadger-io/honeybadger-js",version:"3.2.2"},j=/,/,k=/[^\w]/g,T=/\S/,t=(O.prototype.factory=function(t){throw new Error("Must implement __factory in subclass")},O.prototype.getVersion=function(){return x.version},O.prototype.configure=function(t){var e,n=this;for(e in void 0===t&&(t={}),t)this.config[e]=t[e];return this.__pluginsExecuted||(this.__pluginsExecuted=!0,this.config.__plugins.forEach(function(t){return t.load(n)})),this},O.prototype.beforeNotify=function(t){return this.__beforeNotifyHandlers.push(t),this},O.prototype.afterNotify=function(t){return this.__afterNotifyHandlers.push(t),this},O.prototype.setContext=function(t){return"object"==typeof t&&(this.__context=p(this.__context,t)),this},O.prototype.resetContext=function(t){return this.logger.warn("Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead."),this.__context="object"==typeof t&&null!==t?p({},t):{},this},O.prototype.clear=function(){return this.__context={},this.__breadcrumbs=[],this},O.prototype.notify=function(t,e,n){if(void 0===e&&(e=void 0),void 0===n&&(n=void 0),!this.config.apiKey)return this.logger.warn("Unable to send error report: no API key has been configured"),!1;if(this.config.disabled)return this.logger.warn("Deprecation warning: instead of `disabled: true`, use `reportData: false` to explicitly disable Honeybadger reporting. (Dropping notice: honeybadger.js is disabled)"),!1;if(!this.__reportData())return this.logger.debug("Dropping notice: honeybadger.js is in development mode"),!1;if(t=b(t),e&&"object"!=typeof e&&(e={name:String(e)}),e&&(t=h(t,e)),"object"==typeof n&&null!==n&&(t=h(t,n)),function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return;return 1}(t))return!1;var r=this.__constructTags(t.tags),e=this.__constructTags(this.__context.tags),n=this.__constructTags(this.config.tags),o=r.concat(e).concat(n),e=o.filter(function(t,e){return o.indexOf(t)===e}),n=0;return"string"==typeof(t=p(t,{name:t.name||"Error",context:p(this.__context,t.context),projectRoot:t.projectRoot||this.config.projectRoot,environment:t.environment||this.config.environment,component:t.component||this.config.component,action:t.action||this.config.action,revision:t.revision||this.config.revision,tags:e})).stack&&t.stack.trim()||(t.stack=function(){try{throw new Error("")}catch(t){if(t.stack)return t.stack}for(var t=[],e=arguments.callee;e&&t.length<10;){/function(?:\s+([\w$]+))+\s*\(/.test(e.toString())?t.push(RegExp.$1||"<anonymous>"):t.push("<anonymous>");try{e=e.caller}catch(t){break}}return t.join("\n")}(),n=2),t.backtrace=function(t,e){void 0===e&&(e=0);try{var n=i(t).map(function(t){return{file:t.file,method:t.methodName,number:t.lineNumber,column:t.column}});return n.splice(0,e),n}catch(t){return[]}}(t.stack,n),!!function(t,e){for(var n=0,r=e.length;n<r;n++)if(!1===(0,e[n])(t))return;return 1}(t,this.__beforeNotifyHandlers)&&(this.addBreadcrumb("Honeybadger Notice",{category:"notice",metadata:{message:t.message,name:t.name,stack:t.stack}}),t.__breadcrumbs=this.config.breadcrumbsEnabled?this.__breadcrumbs.slice():[],this.__send(t))},O.prototype.addBreadcrumb=function(t,e){if(this.config.breadcrumbsEnabled){var n=m((e=e||{}).metadata),r=e.category||"custom",e=(new Date).toISOString();this.__breadcrumbs.push({category:r,message:t,metadata:n,timestamp:e});e=this.config.maxBreadcrumbs;return this.__breadcrumbs.length>e&&(this.__breadcrumbs=this.__breadcrumbs.slice(this.__breadcrumbs.length-e)),this}},O.prototype.__reportData=function(){return null!==this.config.reportData?this.config.reportData:!(this.config.environment&&this.config.developmentEnvironments.includes(this.config.environment))},O.prototype.__send=function(t){throw new Error("Must implement send in subclass")},O.prototype.__buildPayload=function(t){var e=v(t.headers,this.config.filters)||{},e=v(n(n({},t.cgiData),function(n,r){void 0===r&&(r="");var o={};return Object.keys(n).forEach(function(t){var e=r+t.replace(/\W/g,"_").toUpperCase();o[e]=n[t]}),o}(e,"HTTP_")),this.config.filters);return{notifier:x,breadcrumbs:{enabled:!!this.config.breadcrumbsEnabled,trail:t.__breadcrumbs||[]},error:{class:t.name,message:t.message,backtrace:t.backtrace,fingerprint:t.fingerprint,tags:t.tags},request:{url:function(t,n){if(!n)return t;if("string"!=typeof t)return t;var e=t.split(/\?/,2)[1];if(!e)return t;var r=t;return e.split(/[&]\s?/).forEach(function(t){var e=t.split("=",2),t=e[0],e=e[1];w(t,n)&&(r=r.replace(t+"="+e,t+"=[FILTERED]"))}),r}(t.url,this.config.filters),component:t.component,action:t.action,context:t.context,cgi_data:e,params:v(t.params,this.config.filters)||{},session:v(t.session,this.config.filters)||{}},server:{project_root:t.projectRoot,environment_name:t.environment,revision:t.revision,hostname:this.config.hostname,time:(new Date).toUTCString()}}},O.prototype.__constructTags=function(t){return t?t.toString().split(j).map(function(t){return t.replace(k,"")}).filter(function(t){return T.test(t)}):[]},O);function O(t){void 0===t&&(t={}),this.__pluginsExecuted=!1,this.__context={},this.__breadcrumbs=[],this.__beforeNotifyHandlers=[],this.__afterNotifyHandlers=[],this.config=n({apiKey:null,endpoint:"https://api.honeybadger.io",environment:null,hostname:null,projectRoot:null,component:null,action:null,revision:null,reportData:null,breadcrumbsEnabled:!0,maxBreadcrumbs:40,maxObjectDepth:8,logger:console,developmentEnvironments:["dev","development","test"],disabled:!1,debug:!1,tags:null,enableUncaught:!0,enableUnhandledRejection:!0,afterUncaught:function(){return!0},filters:["creditcard","password"],__plugins:[]},t),this.logger=e(this)}function N(n){if(!n||!n.tagName)return"";var r=n.tagName.toLowerCase();if("html"===r)return"";n.id&&(r+="#"+n.id);var t=n.getAttribute("class");t&&t.split(/\s+/).forEach(function(t){r+="."+t}),["alt","name","title","type"].forEach(function(t){var e=n.getAttribute(t);e&&(r+="["+t+'="'+e+'"]')});t=function(e){try{var t=e.parentNode.childNodes,n=[];return Array.prototype.forEach.call(t,function(t){t.tagName&&t.tagName===e.tagName&&n.push(t)}),n}catch(t){return[]}}(n);return 1<t.length&&(r+=":nth-child("+(Array.prototype.indexOf.call(t,n)+1)+")"),r}function R(t){var e=t.textContent||t.innerText||"";return e||"submit"!==t.type&&"button"!==t.type||(e=t.value),function(t,e){t.length>e&&(t=t.substr(0,e)+"...");return t}(e.trim(),300)}function S(t){return-1!==t.toString().indexOf("native")}function H(t){t=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/)||{};return{protocol:t[2],host:t[4],pathname:t[5]}}function C(t){var e=H(t),t=H(document.URL);return!e.host||!e.protocol||e.protocol===t.protocol&&e.host===t.host?e.pathname:e.protocol+"://"+e.host+e.pathname}var U,P,A,D,L,q,I,B=function(){var t=!0;if(window.atob||(t=!1),window.ErrorEvent)try{0===new window.ErrorEvent("").colno&&(t=!1)}catch(t){}return t}(),M=0;function W(t){void 0===t&&(t={});var e=P.call(this,n({async:!0,maxErrors:null,projectRoot:window.location.protocol+"//"+window.location.host},t))||this;return e.__errorsSent=0,e.__lastWrapErr=void 0,e.__beforeNotifyHandlers=[function(t){return e.__exceedsMaxErrors()?(e.logger.debug("Dropping notice: max errors exceeded",t),!1):(t.url||(t.url=document.URL),!0)}],e}return new(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(W,P=t),W.prototype.configure=function(t){return void 0===t&&(t={}),P.prototype.configure.call(this,t)},W.prototype.resetMaxErrors=function(){return this.__errorsSent=0},W.prototype.factory=function(t){return new W(t)},W.prototype.__buildPayload=function(t){var e,n,r={HTTP_USER_AGENT:void 0,HTTP_REFERER:void 0,HTTP_COOKIE:void 0};r.HTTP_USER_AGENT=navigator.userAgent,document.referrer.match(/\S/)&&(r.HTTP_REFERER=document.referrer),(e="string"==typeof t.cookies?(e=t.cookies,n={},e.split(/[;,]\s?/).forEach(function(t){var e=t.split("=",2),t=e[0],e=e[1];n[t]=e}),n):t.cookies)&&(r.HTTP_COOKIE=function(t){if("object"==typeof t){var e,n=[];for(e in t)n.push(e+"="+t[e]);return n.join(";")}}(v(e,this.config.filters)));t=P.prototype.__buildPayload.call(this,t);return t.request.cgi_data=p(r,t.request.cgi_data),t},W.prototype.__send=function(e){var t=this;this.__incrementErrorsCount();var n,r,o=this.__buildPayload(e),i=Array.prototype.slice.call(this.__afterNotifyHandlers);e.afterNotify&&i.unshift(e.afterNotify);try{var a=new XMLHttpRequest;a.open("POST",(n=this.config,r="/v1/notices/js",n.endpoint.trim().replace(/\/$/,"")+"/"+(r=r.trim().replace(/(^\/|\/$)/g,""))),this.config.async),a.setRequestHeader("X-API-Key",this.config.apiKey),a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("Accept","text/json, application/json"),a.send(JSON.stringify(y(o,this.config.maxObjectDepth))),a.onload=function(){if(201!==a.status)return g(e,i,new Error("Bad HTTP response: "+a.status)),void t.logger.debug("Unable to send error report: "+a.status+": "+a.statusText,a,e);g(p(e,{id:JSON.parse(a.response).id}),i),t.logger.debug("Error report sent",e)}}catch(t){g(e,i,t),this.logger.error("Unable to send error report: error while initializing request",t,e)}return!0},W.prototype.__wrap=function(t,e){void 0===e&&(e={});var n,r,o=t;e=e||{};try{return"function"!=typeof o?o:(r=o,"function"!=typeof Object.isExtensible||Object.isExtensible(r)?(o.___hb||(n=this,o.___hb=function(){var t=n.config.enableUncaught;if(!e.catch&&!B&&t)return o.apply(this,arguments);try{return o.apply(this,arguments)}catch(t){if(n.__lastWrapErr===t)throw t;throw n.__lastWrapErr=t,M+=1,clearTimeout(U),U=setTimeout(function(){M=0}),n.addBreadcrumb(e.component?e.component+": "+t.name:t.name,{category:"error",metadata:{message:t.message,name:t.name,stack:t.stack}}),n.notify(t),t}}),o.___hb.___hb=o.___hb,o.___hb):o)}catch(t){return o}},W.prototype.__incrementErrorsCount=function(){return this.__errorsSent++},W.prototype.__exceedsMaxErrors=function(){return this.config.maxErrors&&this.__errorsSent>=this.config.maxErrors},W)({__plugins:[(void 0===I&&(I=window),{load:function(a){_(I,"onerror",function(i){return function(t,e,n,r,o){return function(t,e,n,r,o){if(a.logger.debug("window.onerror callback invoked",arguments),0<M)return a.logger.debug("Ignoring window.onerror (error likely reported earlier)",arguments),--M;a.config.enableUncaught&&(0===n&&/Script error\.?/.test(t)?a.logger.info("Ignoring cross-domain script error: enable CORS to track these types of errors",arguments):((o=b(o)).name||(o.name="window.onerror"),o.message||(o.message=t),o.stack||(o.stack=[o.message,"\n at ? (",e||"unknown",":",n||0,":",r||0,")"].join("")),a.addBreadcrumb("window.onerror"!==o.name&&o.name?"window.onerror: "+o.name:"window.onerror",{category:"error",metadata:{name:o.name,message:o.message,stack:o.stack}}),a.notify(o)))}(t,e,n,r,o),"function"==typeof i&&i.apply(window,arguments)}})}}),(void 0===q&&(q=window),{load:function(r){r.config.enableUnhandledRejection&&_(q,"onunhandledrejection",function(e){return function(t){!function(t){if(r.logger.debug("window.onunhandledrejection callback invoked",arguments),r.config.enableUnhandledRejection){var e=t.reason;if(e instanceof Error){t=e.message+"\n at ? (unknown:0)",t=e.stack||t,t={name:e.name,message:"UnhandledPromiseRejectionWarning: "+e,stack:t};return r.addBreadcrumb("window.onunhandledrejection: "+t.name,{category:"error",metadata:t}),r.notify(t)}var n="string"==typeof e?e:null!==(n=JSON.stringify(e))&&void 0!==n?n:"Unspecified reason";r.notify({name:"window.onunhandledrejection",message:"UnhandledPromiseRejectionWarning: "+n})}}(t),"function"==typeof e&&e.apply(this,arguments)}})}}),(void 0===L&&(L=window),{load:function(i){function t(o){return function(r){return function(t,e){if("function"!=typeof t)return r(t,e);var n=Array.prototype.slice.call(arguments,2);return t=i.__wrap(t,o),r(function(){t.apply(void 0,n)},e)}}}_(L,"setTimeout",t({component:"setTimeout"})),_(L,"setInterval",t({component:"setInterval"}))}}),(void 0===D&&(D=window),{load:function(a){["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"].forEach(function(t){var e=D[t]&&D[t].prototype;e&&Object.prototype.hasOwnProperty.call(e,"addEventListener")&&(_(e,"addEventListener",function(o){var i={component:t+".prototype.addEventListener"};return function(t,e,n,r){try{e&&null!=e.handleEvent&&(e.handleEvent=a.__wrap(e.handleEvent,i))}catch(t){a.logger.error(t)}return o.call(this,t,a.__wrap(e,i),n,r)}}),_(e,"removeEventListener",function(o){return function(t,e,n,r){return o.call(this,t,e,n,r),o.call(this,t,a.__wrap(e),n,r)}}))})}}),(void 0===A&&(A=window),{load:function(a){function t(t){return!0===a.config.breadcrumbsEnabled||(t?!0===a.config.breadcrumbsEnabled[t]:!1!==a.config.breadcrumbsEnabled)}function n(t,e){r=e,a.addBreadcrumb("Page changed",{category:"navigation",metadata:{from:t,to:e}})}function e(e){return function(){var t=2<arguments.length?arguments[2]:void 0;return t&&n(r,String(t)),e.apply(this,arguments)}}var r;t("console")&&["debug","info","warn","error","log"].forEach(function(r){_(A.console,r,function(n){return function(){var t,e=Array.prototype.slice.call(arguments),t=(t=e,Array.isArray(t)?t.map(function(t){try{return String(t)}catch(t){return"[unknown]"}}).join(" "):""),e={category:"log",metadata:{level:r,arguments:y(e,3)}};a.addBreadcrumb(t,e),"function"==typeof n&&Function.prototype.apply.call(n,A.console,arguments)}})}),t("dom")&&A.addEventListener("click",function(t){var e,n,r;try{e=N(t.target),n=function t(e){var n=N(e);if(e.parentNode&&e.parentNode.tagName&&0<(e=t(e.parentNode)).length)return e+" > "+n;return n}(t.target),r=R(t.target)}catch(t){e="UI Click",r=n="[unknown]"}0!==e.length&&a.addBreadcrumb(e,{category:"ui.click",metadata:{selector:n,text:r,event:t}})},!0),t("network")&&(_(XMLHttpRequest.prototype,"open",function(r){return function(){var t=arguments[1],e="string"==typeof arguments[0]?arguments[0].toUpperCase():arguments[0],n=e+" "+C(t);this.__hb_xhr={type:"xhr",method:e,url:t,message:n},"function"==typeof r&&r.apply(this,arguments)}}),_(XMLHttpRequest.prototype,"send",function(t){return function(){var e=this;function n(){var t;4===e.readyState&&(t=void 0,e.__hb_xhr&&(e.__hb_xhr.status_code=e.status,t=e.__hb_xhr.message,delete e.__hb_xhr.message),a.addBreadcrumb(t||"XMLHttpRequest",{category:"request",metadata:e.__hb_xhr}))}"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?_(e,"onreadystatechange",function(t){return function(){n(),"function"==typeof t&&t.apply(this,arguments)}}):e.onreadystatechange=n,"function"==typeof t&&t.apply(e,arguments)}})),!t("network")||function(){if(window.fetch){if(S(window.fetch))return 1;try{var t=document.createElement("iframe");t.style.display="none",document.head.appendChild(t);var e=t.contentWindow.fetch&&S(t.contentWindow.fetch);return document.head.removeChild(t),e}catch(t){console&&console.warn&&console.warn("failed to detect native fetch via iframe: "+t)}}}()&&_(A,"fetch",function(i){return function(){var t,e=arguments[0],n="GET";"string"==typeof e?t=e:"Request"in A&&e instanceof Request?(t=e.url,e.method&&(n=e.method)):t=String(e),arguments[1]&&arguments[1].method&&(n=arguments[1].method),"string"==typeof n&&(n=n.toUpperCase());var r=n+" "+C(t),o={type:"fetch",method:n,url:t};return i.apply(this,arguments).then(function(t){return o.status_code=t.status,a.addBreadcrumb(r,{category:"request",metadata:o}),t}).catch(function(t){throw a.addBreadcrumb("fetch error",{category:"error",metadata:o}),t})}}),t("navigation")&&(r=A.location.href,_(A,"onpopstate",function(t){return function(){if(n(r,A.location.href),t)return t.apply(this,arguments)}}),_(A.history,"pushState",e),_(A.history,"replaceState",e))}})]})});
//# sourceMappingURL=honeybadger.min.js.map

@@ -1,107 +0,12 @@

// Type definitions for honeybadger.js
// Project: https://github.com/honeybadger-io/honeybadger-js
import { NextFunction, Request, Response } from 'express'
declare class Honeybadger {
public factory(opts?: Partial<Honeybadger.Config>): Honeybadger
public notify(notice: Error | string | Partial<Honeybadger.Notice>, name?: string | Partial<Honeybadger.Notice>, extra?: string | Partial<Honeybadger.Notice>): Honeybadger.Notice | false
public configure(opts: Partial<Honeybadger.Config>): Honeybadger
public beforeNotify(func: Honeybadger.BeforeNotifyHandler): Honeybadger
public afterNotify(func: Honeybadger.AfterNotifyHandler): Honeybadger
public setContext(context: Record<string, unknown>): Honeybadger
public resetContext(context?: Record<string, unknown>): Honeybadger
public addBreadcrumb(message: string, opts?: Partial<Honeybadger.BreadcrumbRecord>): Honeybadger
// Server middleware
public requestHandler(req: Request, res: Response, next: NextFunction): void
public errorHandler(err: any, req: Request, _res: Response, next: NextFunction): unknown
public lambdaHandler(handler: any): (event: any, context: any, callback: any) => void
import Client from './types/core/client';
import { Config } from './types/core/types';
import { errorHandler, requestHandler, lambdaHandler } from './types/server/middleware';
declare class Honeybadger extends Client {
errorHandler: typeof errorHandler;
requestHandler: typeof requestHandler;
lambdaHandler: typeof lambdaHandler;
constructor(opts?: Partial<Config>);
factory(opts?: Partial<Config>): Honeybadger;
}
declare namespace Honeybadger {
interface Logger {
log(...args: unknown[]): unknown
info(...args: unknown[]): unknown
debug(...args: unknown[]): unknown
warn(...args: unknown[]): unknown
error(...args: unknown[]): unknown
}
interface Config {
apiKey: string | undefined
endpoint: string,
developmentEnvironments: string[]
environment: string | undefined
hostname: string | undefined
projectRoot: string | undefined
component: string | undefined
action: string | undefined
revision: string | undefined
disabled: boolean
debug: boolean
reportData: boolean
breadcrumbsEnabled: boolean | Partial<{ dom: boolean, network: boolean, navigation: boolean, console: boolean }>
maxBreadcrumbs: number
maxObjectDepth: number
logger: Logger
enableUncaught: boolean
afterUncaught: (err: Error) => void
enableUnhandledRejection: boolean
tags: string | string[] | unknown
filters: string[]
[x: string]: unknown
// Browser
async: boolean
maxErrors: number
}
interface BeforeNotifyHandler {
(notice: Notice): boolean | void
}
interface AfterNotifyHandler {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(error: any, notice: Notice): boolean | void
}
interface Notice {
id: string | undefined,
name: string,
message: string,
stack: string,
backtrace: BacktraceFrame[],
fingerprint?: string | undefined,
url?: string | undefined,
component?: string | undefined,
action?: string | undefined,
context: Record<string, unknown>,
cgiData: Record<string, unknown>,
params: Record<string, unknown>,
session: Record<string, unknown>,
headers: Record<string, unknown>,
cookies: Record<string, unknown> | string,
projectRoot?: string | undefined,
environment?: string | undefined,
revision?: string | undefined,
afterNotify?: AfterNotifyHandler
tags: string | string[]
}
interface BacktraceFrame {
file: string,
method: string,
number: number,
column: number
}
interface BreadcrumbRecord {
category: string,
message: string,
metadata: Record<string, unknown>,
timestamp: string
}
}
declare const singleton: Honeybadger
export = singleton
declare const _default: Honeybadger;
export default _default;

@@ -258,3 +258,3 @@ 'use strict';

function newObject(obj) {
if (typeof (obj) !== 'object') {
if (typeof (obj) !== 'object' || obj === null) {
return {};

@@ -357,3 +357,2 @@ }

* properties as Error, but supports additional Honeybadger properties.)
* @param {!Object} notice
*/

@@ -468,3 +467,3 @@ function makeNotice(thing) {

}
var _a = url.split(/\?/, 2); _a[0]; var query = _a[1];
var query = url.split(/\?/, 2)[1];
if (!query) {

@@ -495,3 +494,3 @@ return url;

url: 'https://github.com/honeybadger-io/honeybadger-js',
version: '3.2.1'
version: '3.2.2'
};

@@ -509,6 +508,11 @@ // Split at commas

if (opts === void 0) { opts = {}; }
/** @internal */
this.__pluginsExecuted = false;
/** @internal */
this.__context = {};
/** @internal */
this.__breadcrumbs = [];
/** @internal */
this.__beforeNotifyHandlers = [];
/** @internal */
this.__afterNotifyHandlers = [];

@@ -552,3 +556,3 @@ 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'], disabled: false, debug: false, tags: null, enableUncaught: true, enableUnhandledRejection: true, afterUncaught: function () { return true; }, filters: ['creditcard', 'password'], __plugins: [] }, opts);

this.logger.warn('Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.');
if (typeof context === 'object') {
if (typeof context === 'object' && context !== null) {
this.__context = merge({}, context);

@@ -589,3 +593,3 @@ }

}
if (typeof extra === 'object') {
if (typeof extra === 'object' && extra !== null) {
notice = mergeNotice(notice, extra);

@@ -652,2 +656,3 @@ }

};
/** @internal */
Client.prototype.__reportData = function () {

@@ -659,5 +664,7 @@ if (this.config.reportData !== null) {

};
/** @internal */
Client.prototype.__send = function (_notice) {
throw (new Error('Must implement send in subclass'));
};
/** @internal */
Client.prototype.__buildPayload = function (notice) {

@@ -697,2 +704,3 @@ var headers = filter(notice.headers, this.config.filters) || {};

};
/** @internal */
Client.prototype.__constructTags = function (tags) {

@@ -802,3 +810,5 @@ if (!tags) {

var address = connection && connection.address();
// @ts-ignore The old @types/node incorrectly defines `address` as string|Address
var port = address ? address.port : undefined;
// @ts-ignore
return url__default['default'].format({

@@ -822,2 +832,3 @@ protocol: req.protocol,

params: req.body,
// @ts-ignore
session: req.session,

@@ -868,2 +879,3 @@ headers: req.headers,

var _this = _super.call(this, __assign({ afterUncaught: fatallyLogAndExit, projectRoot: process.cwd(), hostname: os__default['default'].hostname() }, opts)) || this;
/** @internal */
_this.__beforeNotifyHandlers = [

@@ -888,2 +900,3 @@ function (notice) {

};
/** @internal */
Honeybadger.prototype.__send = function (notice) {

@@ -890,0 +903,0 @@ var _this = this;

// Type definitions for honeybadger.js
// Project: https://github.com/honeybadger-io/honeybadger-js
import { NextFunction, Request, Response } from 'express'
import Server from './dist/server/types/server'
import Browser from './dist/browser/types/browser'
declare class Honeybadger {
public factory(opts?: Partial<Honeybadger.Config>): Honeybadger
public notify(notice: Error | string | Partial<Honeybadger.Notice>, name?: string | Partial<Honeybadger.Notice>, extra?: string | Partial<Honeybadger.Notice>): Honeybadger.Notice | false
public configure(opts: Partial<Honeybadger.Config>): Honeybadger
public beforeNotify(func: Honeybadger.BeforeNotifyHandler): Honeybadger
public afterNotify(func: Honeybadger.AfterNotifyHandler): Honeybadger
public setContext(context: Record<string, unknown>): Honeybadger
public resetContext(context?: Record<string, unknown>): Honeybadger
public addBreadcrumb(message: string, opts?: Partial<Honeybadger.BreadcrumbRecord>): Honeybadger
// Server middleware
public requestHandler(req: Request, res: Response, next: NextFunction): void
public errorHandler(err: any, req: Request, _res: Response, next: NextFunction): unknown
public lambdaHandler(handler: any): (event: any, context: any, callback: any) => void
}
declare namespace Honeybadger {
interface Logger {
log(...args: unknown[]): unknown
info(...args: unknown[]): unknown
debug(...args: unknown[]): unknown
warn(...args: unknown[]): unknown
error(...args: unknown[]): unknown
}
interface Config {
apiKey: string | undefined
endpoint: string,
developmentEnvironments: string[]
environment: string | undefined
hostname: string | undefined
projectRoot: string | undefined
component: string | undefined
action: string | undefined
revision: string | undefined
disabled: boolean
debug: boolean
reportData: boolean
breadcrumbsEnabled: boolean | Partial<{ dom: boolean, network: boolean, navigation: boolean, console: boolean }>
maxBreadcrumbs: number
maxObjectDepth: number
logger: Logger
enableUncaught: boolean
afterUncaught: (err: Error) => void
enableUnhandledRejection: boolean
tags: string | string[] | unknown
filters: string[]
[x: string]: unknown
// Browser
async: boolean
maxErrors: number
}
interface BeforeNotifyHandler {
(notice: Notice): boolean | void
}
interface AfterNotifyHandler {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(error: any, notice: Notice): boolean | void
}
interface Notice {
id: string | undefined,
name: string,
message: string,
stack: string,
backtrace: BacktraceFrame[],
fingerprint?: string | undefined,
url?: string | undefined,
component?: string | undefined,
action?: string | undefined,
context: Record<string, unknown>,
cgiData: Record<string, unknown>,
params: Record<string, unknown>,
session: Record<string, unknown>,
headers: Record<string, unknown>,
cookies: Record<string, unknown> | string,
projectRoot?: string | undefined,
environment?: string | undefined,
revision?: string | undefined,
afterNotify?: AfterNotifyHandler
tags: string | string[]
}
interface BacktraceFrame {
file: string,
method: string,
number: number,
column: number
}
interface BreadcrumbRecord {
category: string,
message: string,
metadata: Record<string, unknown>,
timestamp: string
}
}
declare const singleton: Honeybadger
export = singleton
declare const Honeybadger: typeof Server & typeof Browser
export = Honeybadger
{
"name": "@honeybadger-io/js",
"version": "3.2.1",
"version": "3.2.2",
"license": "MIT",

@@ -33,5 +33,5 @@ "homepage": "https://github.com/honeybadger-io/honeybadger-js",

"prepare": "npm run build",
"test": "concurrently 'npm run test:browser' 'npm run test:server'",
"test:browser": "jest --env=jsdom --testPathPattern='test\\/unit\\/.*(?<![\\.\\/]server)\\.test\\.(js|ts)'",
"test:server": "jest --env=node --testPathPattern='test\\/unit\\/.*(?<![\\.\\/]browser)\\.test\\.(js|ts)'",
"test": "concurrently \"npm:test:browser\" \"npm:test:server\"",
"test:browser": "jest --env=jsdom --testPathPattern=\"test/unit/.*(?<![\\./]server)\\.test\\.(js|ts)\"",
"test:server": "jest --env=node --testPathPattern=\"test/unit/.*(?<![\\./]browser)\\.test\\.(js|ts)\"",
"test:integration": "npm run build && test/integration/node_modules/karma/bin/karma start test/integration/karma.conf.js",

@@ -41,33 +41,34 @@ "test:integration:browserstack": "npm run test:integration",

"tsd": "npm run build && tsd",
"build": "rollup -c && cp honeybadger.d.ts dist/server && cp honeybadger.d.ts dist/browser",
"build": "rollup -c && node ./scripts/copy-typedefs.js",
"release": "shipjs prepare"
},
"dependencies": {
"@types/express": "^4.17.13",
"stacktrace-parser": "^0.1.10"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-replace": "^2.4.2",
"@rollup/plugin-typescript": "^8.2.1",
"@types/jest": "^26.0.23",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"@rollup/plugin-node-resolve": "^13.0.2",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/plugin-typescript": "^8.2.3",
"@types/jest": "^26.0.24",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"axios": ">=0.21.1",
"concurrently": "^6.1.0",
"eslint": "^7.26.0",
"eslint-plugin-import": "^2.23.2",
"concurrently": "^6.2.0",
"eslint": "^7.31.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-promise": "^5.1.0",
"express": "^4.17.1",
"jest": "^26.4.2",
"nock": "^13.0.11",
"rollup": "^2.48.0",
"jest": "^27.0.6",
"nock": "^13.1.1",
"rollup": "^2.53.2",
"rollup-plugin-uglify": "^6.0.2",
"shipjs": "0.23.2",
"sinon": "^10.0.0",
"shipjs": "0.23.3",
"sinon": "^11.1.1",
"supertest": "^6.1.3",
"ts-jest": "^26.5.6",
"tsd": "^0.15.1",
"tslib": "^2.2.0",
"typescript": "^4.2.4"
"ts-jest": "^27.0.3",
"tsd": "^0.17.0",
"tslib": "^2.3.0",
"typescript": "^4.3.5"
},

@@ -79,3 +80,8 @@ "readmeFilename": "README.md",

],
"tsd": {
"compilerOptions": {
"strict": false
}
},
"types": "./honeybadger.d.ts"
}

@@ -30,6 +30,17 @@ # Honeybadger for JavaScript

1. Run `npm install`.
2. To run the test suite by itself, use `npm test`.
3. To run the tests across all supported platforms, set up a [BrowserStack](https://www.browserstack.com/)
2. To run unit tests for both browser and server builds: `npm test`. Or separately: `npm run test:browser`, `npm run test:server`.
3. To run integration tests across all supported platforms, set up a [BrowserStack](https://www.browserstack.com/)
account and use `BROWSERSTACK_USERNAME=your_username BROWSERSTACK_ACCESS_KEY=your-access-key npm run test:integration`.
4. To test the TypeScript type definitions: `npm run tsd`.
### Bundling and types
This project is _isomorphic_, meaning it's a single library which contains both browser and server builds. It's written in TypeScript, and transpiled and bundled with Rollup. Our Rollup config generates three main files:
1. The server build, which transpiles `src/server.ts` and its dependencies into `dist/server/honeybadger.js`.
2. The browser build, which transpiles `src/browser.ts` and its dependencies into `dist/browser/honeybadger.js`.
3. The minified browser build, which transpiles `src/browser.ts` and its dependencies into `dist/browser/honeybadger.min.js` (+ source maps).
In addition, the TypeScript type declaration for each build is generated into its `types/` directory (ie `dist/browser/types/browser.d.ts` and `dist/server/types/server.d.ts`).
However, since the package is isomorphic, TypeScript users will likely be writing `import * as Honeybadger from '@honeybadger-io/js'` or `import Honeybadger = require('@honeybadger-io/js')` in their IDE. Our `package.json` has ` main` and `browser` fields that determine which build they get, but [there can only be a single type declaration file](https://github.com/Microsoft/TypeScript/issues/29128). So we use an extra file in the project root, `honeybadger.d.ts`, that combines the types from both builds.
## Releasing

@@ -36,0 +47,0 @@

Sorry, the diff of this file is not supported yet

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