@sentry/browser
Advanced tools
Comparing version 4.6.4 to 5.0.0-rc.0
@@ -1,3 +0,4 @@ | ||
import { BaseBackend, Options } from '@sentry/core/esm'; | ||
import { SentryEvent, SentryEventHint, Severity, Transport } from '@sentry/types/esm'; | ||
import { BaseBackend } from '@sentry/core'; | ||
import { Event, EventHint, Options, Severity, Transport } from '@sentry/types'; | ||
import { SyncPromise } from '@sentry/utils/syncpromise'; | ||
/** | ||
@@ -21,3 +22,6 @@ * Configuration options for the Sentry Browser SDK. | ||
} | ||
/** The Sentry Browser SDK Backend. */ | ||
/** | ||
* The Sentry Browser SDK Backend. | ||
* @hidden | ||
*/ | ||
export declare class BrowserBackend extends BaseBackend<BrowserOptions> { | ||
@@ -27,15 +31,15 @@ /** | ||
*/ | ||
install(): boolean; | ||
protected _setupTransport(): Transport; | ||
/** | ||
* @inheritdoc | ||
* @inheritDoc | ||
*/ | ||
protected setupTransport(): Transport; | ||
eventFromException(exception: any, hint?: EventHint): SyncPromise<Event>; | ||
/** | ||
* @inheritDoc | ||
* This is an internal helper function that creates an event. | ||
*/ | ||
eventFromException(exception: any, hint?: SentryEventHint): Promise<SentryEvent>; | ||
private _buildEvent; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
eventFromMessage(message: string, level?: Severity, hint?: SentryEventHint): Promise<SentryEvent>; | ||
eventFromMessage(message: string, level?: Severity, hint?: EventHint): SyncPromise<Event>; | ||
} |
@@ -1,9 +0,14 @@ | ||
import { BaseBackend, SentryError } from '@sentry/core/esm'; | ||
import { Severity } from '@sentry/types/esm'; | ||
import { isDOMError, isDOMException, isError, isErrorEvent, isPlainObject } from '@sentry/utils/esm/is'; | ||
import { supportsBeacon, supportsFetch } from '@sentry/utils/esm/supports'; | ||
import { addExceptionTypeValue, eventFromPlainObject, eventFromStacktrace, prepareFramesForEvent } from './parsers'; | ||
import { BaseBackend } from '@sentry/core'; | ||
import { Severity } from '@sentry/types'; | ||
import { isDOMError, isDOMException, isError, isErrorEvent, isPlainObject } from '@sentry/utils/is'; | ||
import { addExceptionTypeValue } from '@sentry/utils/misc'; | ||
import { supportsBeacon, supportsFetch } from '@sentry/utils/supports'; | ||
import { SyncPromise } from '@sentry/utils/syncpromise'; | ||
import { eventFromPlainObject, eventFromStacktrace, prepareFramesForEvent } from './parsers'; | ||
import { computeStackTrace } from './tracekit'; | ||
import { BeaconTransport, FetchTransport, XHRTransport } from './transports'; | ||
/** The Sentry Browser SDK Backend. */ | ||
/** | ||
* The Sentry Browser SDK Backend. | ||
* @hidden | ||
*/ | ||
export class BrowserBackend extends BaseBackend { | ||
@@ -13,29 +18,17 @@ /** | ||
*/ | ||
install() { | ||
// We are only called by the client if the SDK is enabled and a valid Dsn | ||
// has been configured. If no Dsn is present, this indicates a programming | ||
// error. | ||
const dsn = this.options.dsn; | ||
if (!dsn) { | ||
throw new SentryError('Invariant exception: install() must not be called when disabled'); | ||
} | ||
Error.stackTraceLimit = 50; | ||
return true; | ||
} | ||
/** | ||
* @inheritdoc | ||
*/ | ||
setupTransport() { | ||
if (!this.options.dsn) { | ||
_setupTransport() { | ||
if (!this._options.dsn) { | ||
// We return the noop transport here in case there is no Dsn. | ||
return super.setupTransport(); | ||
return super._setupTransport(); | ||
} | ||
const transportOptions = this.options.transportOptions ? this.options.transportOptions : { dsn: this.options.dsn }; | ||
if (this.options.transport) { | ||
return new this.options.transport(transportOptions); | ||
const transportOptions = this._options.transportOptions | ||
? this._options.transportOptions | ||
: { dsn: this._options.dsn }; | ||
if (this._options.transport) { | ||
return new this._options.transport(transportOptions); | ||
} | ||
else if (supportsBeacon()) { | ||
if (supportsBeacon()) { | ||
return new BeaconTransport(transportOptions); | ||
} | ||
else if (supportsFetch()) { | ||
if (supportsFetch()) { | ||
return new FetchTransport(transportOptions); | ||
@@ -48,11 +41,12 @@ } | ||
*/ | ||
async eventFromException(exception, hint) { | ||
eventFromException(exception, hint) { | ||
let event; | ||
if (isErrorEvent(exception) && exception.error) { | ||
// If it is an ErrorEvent with `error` property, extract it to get actual Error | ||
const ex = exception; | ||
exception = ex.error; // tslint:disable-line:no-parameter-reassignment | ||
const errorEvent = exception; | ||
exception = errorEvent.error; // tslint:disable-line:no-parameter-reassignment | ||
event = eventFromStacktrace(computeStackTrace(exception)); | ||
return SyncPromise.resolve(this._buildEvent(event, hint)); | ||
} | ||
else if (isDOMError(exception) || isDOMException(exception)) { | ||
if (isDOMError(exception) || isDOMException(exception)) { | ||
// If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers) | ||
@@ -62,48 +56,56 @@ // then we just extract the name and message, as they don't provide anything else | ||
// https://developer.mozilla.org/en-US/docs/Web/API/DOMException | ||
const ex = exception; | ||
const name = ex.name || (isDOMError(ex) ? 'DOMError' : 'DOMException'); | ||
const message = ex.message ? `${name}: ${ex.message}` : name; | ||
event = await this.eventFromMessage(message, Severity.Error, hint); | ||
addExceptionTypeValue(event, message); | ||
const domException = exception; | ||
const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException'); | ||
const message = domException.message ? `${name}: ${domException.message}` : name; | ||
return this.eventFromMessage(message, Severity.Error, hint).then(messageEvent => { | ||
addExceptionTypeValue(messageEvent, message); | ||
return SyncPromise.resolve(this._buildEvent(messageEvent, hint)); | ||
}); | ||
} | ||
else if (isError(exception)) { | ||
if (isError(exception)) { | ||
// we have a real Error object, do nothing | ||
event = eventFromStacktrace(computeStackTrace(exception)); | ||
return SyncPromise.resolve(this._buildEvent(event, hint)); | ||
} | ||
else if (isPlainObject(exception) && hint && hint.syntheticException) { | ||
if (isPlainObject(exception) && hint && hint.syntheticException) { | ||
// If it is plain Object, serialize it manually and extract options | ||
// This will allow us to group events based on top-level keys | ||
// which is much better than creating new group when any key/value change | ||
const ex = exception; | ||
event = eventFromPlainObject(ex, hint.syntheticException); | ||
addExceptionTypeValue(event, 'Custom Object'); | ||
const objectException = exception; | ||
event = eventFromPlainObject(objectException, hint.syntheticException); | ||
addExceptionTypeValue(event, 'Custom Object', undefined, { | ||
handled: true, | ||
synthetic: true, | ||
type: 'generic', | ||
}); | ||
event.level = Severity.Error; | ||
return SyncPromise.resolve(this._buildEvent(event, hint)); | ||
} | ||
else { | ||
// If none of previous checks were valid, then it means that | ||
// it's not a DOMError/DOMException | ||
// it's not a plain Object | ||
// it's not a valid ErrorEvent (one with an error property) | ||
// it's not an Error | ||
// So bail out and capture it as a simple message: | ||
const ex = exception; | ||
event = await this.eventFromMessage(ex, undefined, hint); | ||
addExceptionTypeValue(event, `${ex}`); | ||
} | ||
event = { | ||
...event, | ||
event_id: hint && hint.event_id, | ||
exception: { | ||
...event.exception, | ||
mechanism: { | ||
handled: true, | ||
type: 'generic', | ||
}, | ||
}, | ||
}; | ||
return event; | ||
// If none of previous checks were valid, then it means that | ||
// it's not a DOMError/DOMException | ||
// it's not a plain Object | ||
// it's not a valid ErrorEvent (one with an error property) | ||
// it's not an Error | ||
// So bail out and capture it as a simple message: | ||
const stringException = exception; | ||
return this.eventFromMessage(stringException, undefined, hint).then(messageEvent => { | ||
addExceptionTypeValue(messageEvent, `${stringException}`, undefined, { | ||
handled: true, | ||
synthetic: true, | ||
type: 'generic', | ||
}); | ||
messageEvent.level = Severity.Error; | ||
return SyncPromise.resolve(this._buildEvent(messageEvent, hint)); | ||
}); | ||
} | ||
/** | ||
* This is an internal helper function that creates an event. | ||
*/ | ||
_buildEvent(event, hint) { | ||
return Object.assign({}, event, { event_id: hint && hint.event_id }); | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
async eventFromMessage(message, level = Severity.Info, hint) { | ||
eventFromMessage(message, level = Severity.Info, hint) { | ||
const event = { | ||
@@ -114,3 +116,3 @@ event_id: hint && hint.event_id, | ||
}; | ||
if (this.options.attachStacktrace && hint && hint.syntheticException) { | ||
if (this._options.attachStacktrace && hint && hint.syntheticException) { | ||
const stacktrace = computeStackTrace(hint.syntheticException); | ||
@@ -122,5 +124,5 @@ const frames = prepareFramesForEvent(stacktrace.stack); | ||
} | ||
return event; | ||
return SyncPromise.resolve(event); | ||
} | ||
} | ||
//# sourceMappingURL=backend.js.map |
@@ -1,3 +0,4 @@ | ||
import { BaseClient, Scope } from '@sentry/core/esm'; | ||
import { DsnLike, SentryEvent, SentryEventHint } from '@sentry/types/esm'; | ||
import { BaseClient, Scope } from '@sentry/core'; | ||
import { DsnLike, Event, EventHint } from '@sentry/types'; | ||
import { SyncPromise } from '@sentry/utils/syncpromise'; | ||
import { BrowserBackend, BrowserOptions } from './backend'; | ||
@@ -40,7 +41,7 @@ /** | ||
*/ | ||
constructor(options: BrowserOptions); | ||
constructor(options?: BrowserOptions); | ||
/** | ||
* @inheritDoc | ||
*/ | ||
protected prepareEvent(event: SentryEvent, scope?: Scope, hint?: SentryEventHint): Promise<SentryEvent | null>; | ||
protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): SyncPromise<Event | null>; | ||
/** | ||
@@ -47,0 +48,0 @@ * Show a report dialog to the user to send feedback to a specific event. |
@@ -1,4 +0,4 @@ | ||
import { API, BaseClient } from '@sentry/core/esm'; | ||
import { logger } from '@sentry/utils/esm/logger'; | ||
import { getGlobalObject } from '@sentry/utils/esm/misc'; | ||
import { API, BaseClient } from '@sentry/core'; | ||
import { logger } from '@sentry/utils/logger'; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
import { BrowserBackend } from './backend'; | ||
@@ -18,3 +18,3 @@ import { SDK_NAME, SDK_VERSION } from './version'; | ||
*/ | ||
constructor(options) { | ||
constructor(options = {}) { | ||
super(BrowserBackend, options); | ||
@@ -25,8 +25,5 @@ } | ||
*/ | ||
async prepareEvent(event, scope, hint) { | ||
_prepareEvent(event, scope, hint) { | ||
event.platform = event.platform || 'javascript'; | ||
event.sdk = { | ||
...event.sdk, | ||
name: SDK_NAME, | ||
packages: [ | ||
event.sdk = Object.assign({}, event.sdk, { name: SDK_NAME, packages: [ | ||
...((event.sdk && event.sdk.packages) || []), | ||
@@ -37,6 +34,4 @@ { | ||
}, | ||
], | ||
version: SDK_VERSION, | ||
}; | ||
return super.prepareEvent(event, scope, hint); | ||
], version: SDK_VERSION }); | ||
return super._prepareEvent(event, scope, hint); | ||
} | ||
@@ -54,3 +49,3 @@ /** | ||
} | ||
if (!this.isEnabled()) { | ||
if (!this._isEnabled()) { | ||
logger.error('Trying to call showReportDialog with Sentry Client is disabled'); | ||
@@ -57,0 +52,0 @@ return; |
@@ -1,8 +0,8 @@ | ||
export { Breadcrumb, Request, SdkInfo, SentryEvent, SentryException, SentryResponse, Severity, StackFrame, Stacktrace, Status, Thread, User, } from '@sentry/types/esm'; | ||
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, withScope, getHubFromCarrier, getCurrentHub, Hub, Scope, } from '@sentry/core/esm'; | ||
export { BrowserBackend, BrowserOptions } from './backend'; | ||
export { Breadcrumb, Request, SdkInfo, Event, Exception, Response, Severity, StackFrame, Stacktrace, Status, Thread, User, } from '@sentry/types'; | ||
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, withScope, getHubFromCarrier, getCurrentHub, Hub, Scope, } from '@sentry/core'; | ||
export { BrowserOptions } from './backend'; | ||
export { BrowserClient, ReportDialogOptions } from './client'; | ||
export { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close } from './sdk'; | ||
export { SDK_NAME, SDK_VERSION } from './version'; | ||
import { Integrations as CoreIntegrations } from '@sentry/core/esm'; | ||
import { Integrations as CoreIntegrations } from '@sentry/core'; | ||
import * as BrowserIntegrations from './integrations'; | ||
@@ -16,13 +16,5 @@ import * as Transports from './transports'; | ||
UserAgent: typeof BrowserIntegrations.UserAgent; | ||
Ember: typeof BrowserIntegrations.Ember; | ||
Vue: typeof BrowserIntegrations.Vue; | ||
ReportingObserver: typeof BrowserIntegrations.ReportingObserver; | ||
Dedupe: typeof CoreIntegrations.Dedupe; | ||
FunctionToString: typeof CoreIntegrations.FunctionToString; | ||
SDKInformation: typeof CoreIntegrations.SDKInformation; | ||
InboundFilters: typeof CoreIntegrations.InboundFilters; | ||
ExtraErrorData: typeof CoreIntegrations.ExtraErrorData; | ||
Debug: typeof CoreIntegrations.Debug; | ||
RewriteFrames: typeof CoreIntegrations.RewriteFrames; | ||
}; | ||
export { INTEGRATIONS as Integrations, Transports }; |
@@ -1,15 +0,11 @@ | ||
export { Severity, Status, } from '@sentry/types/esm'; | ||
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, withScope, getHubFromCarrier, getCurrentHub, Hub, Scope, } from '@sentry/core/esm'; | ||
export { BrowserBackend } from './backend'; | ||
export { Severity, Status, } from '@sentry/types'; | ||
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, withScope, getHubFromCarrier, getCurrentHub, Hub, Scope, } from '@sentry/core'; | ||
export { BrowserClient } from './client'; | ||
export { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close } from './sdk'; | ||
export { SDK_NAME, SDK_VERSION } from './version'; | ||
import { Integrations as CoreIntegrations } from '@sentry/core/esm'; | ||
import { Integrations as CoreIntegrations } from '@sentry/core'; | ||
import * as BrowserIntegrations from './integrations'; | ||
import * as Transports from './transports'; | ||
const INTEGRATIONS = { | ||
...CoreIntegrations, | ||
...BrowserIntegrations, | ||
}; | ||
const INTEGRATIONS = Object.assign({}, CoreIntegrations, BrowserIntegrations); | ||
export { INTEGRATIONS as Integrations, Transports }; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,5 @@ | ||
import { Breadcrumb, Integration, SentryBreadcrumbHint } from '@sentry/types/esm'; | ||
/** JSDoc */ | ||
import { Breadcrumb, BreadcrumbHint, Integration } from '@sentry/types'; | ||
/** | ||
* @hidden | ||
*/ | ||
export interface SentryWrappedXMLHttpRequest extends XMLHttpRequest { | ||
@@ -32,3 +34,3 @@ [key: string]: any; | ||
/** JSDoc */ | ||
private readonly options; | ||
private readonly _options; | ||
/** | ||
@@ -38,20 +40,22 @@ * @inheritDoc | ||
constructor(options?: BreadcrumbIntegrations); | ||
/** | ||
* @hidden | ||
*/ | ||
private _instrumentBeacon; | ||
/** JSDoc */ | ||
private instrumentBeacon; | ||
private _instrumentConsole; | ||
/** JSDoc */ | ||
private instrumentConsole; | ||
private _instrumentDOM; | ||
/** JSDoc */ | ||
private instrumentDOM; | ||
private _instrumentFetch; | ||
/** JSDoc */ | ||
private instrumentFetch; | ||
private _instrumentHistory; | ||
/** JSDoc */ | ||
private instrumentHistory; | ||
/** JSDoc */ | ||
private instrumentXHR; | ||
private _instrumentXHR; | ||
/** | ||
* Helper that checks if integration is enabled on the client. | ||
* @param breadcrumb Breadcrumb | ||
* @param hint SentryBreadcrumbHint | ||
* @param hint BreadcrumbHint | ||
*/ | ||
static addBreadcrumb(breadcrumb: Breadcrumb, hint?: SentryBreadcrumbHint): void; | ||
static addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void; | ||
/** | ||
@@ -58,0 +62,0 @@ * Instrument browser built-ins w/ breadcrumb capturing |
@@ -1,9 +0,9 @@ | ||
import { API, getCurrentHub } from '@sentry/core/esm'; | ||
import { Severity } from '@sentry/types/esm'; | ||
import { isFunction, isString } from '@sentry/utils/esm/is'; | ||
import { logger } from '@sentry/utils/esm/logger'; | ||
import { getEventDescription, getGlobalObject, parseUrl } from '@sentry/utils/esm/misc'; | ||
import { deserialize, fill, safeNormalize } from '@sentry/utils/esm/object'; | ||
import { includes, safeJoin } from '@sentry/utils/esm/string'; | ||
import { supportsBeacon, supportsHistory, supportsNativeFetch } from '@sentry/utils/esm/supports'; | ||
import { API, getCurrentHub } from '@sentry/core'; | ||
import { Severity } from '@sentry/types'; | ||
import { isString } from '@sentry/utils/is'; | ||
import { logger } from '@sentry/utils/logger'; | ||
import { getEventDescription, getGlobalObject, parseUrl } from '@sentry/utils/misc'; | ||
import { fill, normalize } from '@sentry/utils/object'; | ||
import { safeJoin } from '@sentry/utils/string'; | ||
import { supportsBeacon, supportsHistory, supportsNativeFetch } from '@sentry/utils/supports'; | ||
import { breadcrumbEventHandler, keypressEventHandler, wrap } from './helpers'; | ||
@@ -22,19 +22,14 @@ const global = getGlobalObject(); | ||
this.name = Breadcrumbs.id; | ||
this.options = { | ||
beacon: true, | ||
console: true, | ||
dom: true, | ||
fetch: true, | ||
history: true, | ||
sentry: true, | ||
xhr: true, | ||
...options, | ||
}; | ||
this._options = Object.assign({ beacon: true, console: true, dom: true, fetch: true, history: true, sentry: true, xhr: true }, options); | ||
} | ||
/** JSDoc */ | ||
instrumentBeacon() { | ||
/** | ||
* @hidden | ||
*/ | ||
_instrumentBeacon() { | ||
if (!supportsBeacon()) { | ||
return; | ||
} | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
function beaconReplacementFunction(originalBeaconFunction) { | ||
@@ -53,3 +48,3 @@ return function (...args) { | ||
// but rather as our own 'sentry' type breadcrumb | ||
if (filterUrl && includes(url, filterUrl)) { | ||
if (filterUrl && url.includes(filterUrl)) { | ||
addSentryBreadcrumb(data); | ||
@@ -78,3 +73,3 @@ return result; | ||
/** JSDoc */ | ||
instrumentConsole() { | ||
_instrumentConsole() { | ||
if (!('console' in global)) { | ||
@@ -93,3 +88,3 @@ return; | ||
extra: { | ||
arguments: safeNormalize(args, 3), | ||
arguments: normalize(args, 3), | ||
}, | ||
@@ -104,3 +99,3 @@ logger: 'console', | ||
breadcrumbData.message = `Assertion failed: ${safeJoin(args.slice(1), ' ') || 'console.assert'}`; | ||
breadcrumbData.data.extra.arguments = safeNormalize(args.slice(1), 3); | ||
breadcrumbData.data.extra.arguments = normalize(args.slice(1), 3); | ||
} | ||
@@ -121,3 +116,3 @@ } | ||
/** JSDoc */ | ||
instrumentDOM() { | ||
_instrumentDOM() { | ||
if (!('document' in global)) { | ||
@@ -132,3 +127,3 @@ return; | ||
/** JSDoc */ | ||
instrumentFetch() { | ||
_instrumentFetch() { | ||
if (!supportsNativeFetch()) { | ||
@@ -163,3 +158,3 @@ return; | ||
// but rather as our own 'sentry' type breadcrumb | ||
if (filterUrl && includes(url, filterUrl)) { | ||
if (filterUrl && url.includes(filterUrl)) { | ||
if (method === 'POST' && args[1] && args[1].body) { | ||
@@ -205,3 +200,3 @@ addSentryBreadcrumb(args[1].body); | ||
/** JSDoc */ | ||
instrumentHistory() { | ||
_instrumentHistory() { | ||
if (!supportsHistory()) { | ||
@@ -249,3 +244,5 @@ return; | ||
}; | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
function historyReplacementFunction(originalHistoryFunction) { | ||
@@ -268,10 +265,12 @@ // note history.pushState.length is 0; intentionally not declaring | ||
/** JSDoc */ | ||
instrumentXHR() { | ||
_instrumentXHR() { | ||
if (!('XMLHttpRequest' in global)) { | ||
return; | ||
} | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
function wrapProp(prop, xhr) { | ||
// TODO: Fix XHR types | ||
if (prop in xhr && isFunction(xhr[prop])) { | ||
if (prop in xhr && typeof xhr[prop] === 'function') { | ||
fill(xhr, prop, original => wrap(original, { | ||
@@ -302,3 +301,3 @@ mechanism: { | ||
// but rather as our own 'sentry' type breadcrumb | ||
if (isString(url) && (filterUrl && includes(url, filterUrl))) { | ||
if (isString(url) && (filterUrl && url.includes(filterUrl))) { | ||
this.__sentry_own_request__ = true; | ||
@@ -314,3 +313,5 @@ } | ||
} | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
function onreadystatechangeHandler() { | ||
@@ -343,3 +344,3 @@ if (xhr.readyState === 4) { | ||
}); | ||
if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) { | ||
if ('onreadystatechange' in xhr && typeof xhr.onreadystatechange === 'function') { | ||
fill(xhr, 'onreadystatechange', function (original) { | ||
@@ -369,3 +370,3 @@ return wrap(original, { | ||
* @param breadcrumb Breadcrumb | ||
* @param hint SentryBreadcrumbHint | ||
* @param hint BreadcrumbHint | ||
*/ | ||
@@ -386,19 +387,19 @@ static addBreadcrumb(breadcrumb, hint) { | ||
setupOnce() { | ||
if (this.options.console) { | ||
this.instrumentConsole(); | ||
if (this._options.console) { | ||
this._instrumentConsole(); | ||
} | ||
if (this.options.dom) { | ||
this.instrumentDOM(); | ||
if (this._options.dom) { | ||
this._instrumentDOM(); | ||
} | ||
if (this.options.xhr) { | ||
this.instrumentXHR(); | ||
if (this._options.xhr) { | ||
this._instrumentXHR(); | ||
} | ||
if (this.options.fetch) { | ||
this.instrumentFetch(); | ||
if (this._options.fetch) { | ||
this._instrumentFetch(); | ||
} | ||
if (this.options.beacon) { | ||
this.instrumentBeacon(); | ||
if (this._options.beacon) { | ||
this._instrumentBeacon(); | ||
} | ||
if (this.options.history) { | ||
this.instrumentHistory(); | ||
if (this._options.history) { | ||
this._instrumentHistory(); | ||
} | ||
@@ -415,3 +416,3 @@ } | ||
try { | ||
const event = deserialize(serializedData); | ||
const event = JSON.parse(serializedData); | ||
Breadcrumbs.addBreadcrumb({ | ||
@@ -418,0 +419,0 @@ category: 'sentry', |
@@ -1,2 +0,2 @@ | ||
import { Integration } from '@sentry/types/esm'; | ||
import { Integration } from '@sentry/types'; | ||
/** JSDoc */ | ||
@@ -18,3 +18,3 @@ interface GlobalHandlersIntegrations { | ||
/** JSDoc */ | ||
private readonly options; | ||
private readonly _options; | ||
/** JSDoc */ | ||
@@ -27,8 +27,8 @@ constructor(options?: GlobalHandlersIntegrations); | ||
/** | ||
* This function creates an SentryEvent from an TraceKitStackTrace. | ||
* This function creates an Event from an TraceKitStackTrace. | ||
* | ||
* @param stacktrace TraceKitStackTrace to be converted to an SentryEvent. | ||
* @param stacktrace TraceKitStackTrace to be converted to an Event. | ||
*/ | ||
private eventFromGlobalHandler; | ||
private _eventFromGlobalHandler; | ||
} | ||
export {}; |
@@ -1,6 +0,7 @@ | ||
import { getCurrentHub } from '@sentry/core/esm'; | ||
import { logger } from '@sentry/utils/esm/logger'; | ||
import { safeNormalize, serialize } from '@sentry/utils/esm/object'; | ||
import { truncate } from '@sentry/utils/esm/string'; | ||
import { addExceptionTypeValue, eventFromStacktrace } from '../parsers'; | ||
import { getCurrentHub } from '@sentry/core'; | ||
import { logger } from '@sentry/utils/logger'; | ||
import { addExceptionTypeValue } from '@sentry/utils/misc'; | ||
import { normalize } from '@sentry/utils/object'; | ||
import { truncate } from '@sentry/utils/string'; | ||
import { eventFromStacktrace } from '../parsers'; | ||
import { installGlobalHandler, installGlobalUnhandledRejectionHandler, subscribe, } from '../tracekit'; | ||
@@ -16,7 +17,3 @@ import { shouldIgnoreOnError } from './helpers'; | ||
this.name = GlobalHandlers.id; | ||
this.options = { | ||
onerror: true, | ||
onunhandledrejection: true, | ||
...options, | ||
}; | ||
this._options = Object.assign({ onerror: true, onunhandledrejection: true }, options); | ||
} | ||
@@ -27,2 +24,3 @@ /** | ||
setupOnce() { | ||
Error.stackTraceLimit = 50; | ||
subscribe((stack, _, error) => { | ||
@@ -48,10 +46,13 @@ // TODO: use stack.context to get a valuable information from TraceKit, eg. | ||
if (self) { | ||
getCurrentHub().captureEvent(self.eventFromGlobalHandler(stack), { originalException: error, data: { stack } }); | ||
getCurrentHub().captureEvent(self._eventFromGlobalHandler(stack), { | ||
data: { stack }, | ||
originalException: error, | ||
}); | ||
} | ||
}); | ||
if (this.options.onerror) { | ||
if (this._options.onerror) { | ||
logger.log('Global Handler attached: onerror'); | ||
installGlobalHandler(); | ||
} | ||
if (this.options.onunhandledrejection) { | ||
if (this._options.onunhandledrejection) { | ||
logger.log('Global Handler attached: onunhandledrejection'); | ||
@@ -62,7 +63,7 @@ installGlobalUnhandledRejectionHandler(); | ||
/** | ||
* This function creates an SentryEvent from an TraceKitStackTrace. | ||
* This function creates an Event from an TraceKitStackTrace. | ||
* | ||
* @param stacktrace TraceKitStackTrace to be converted to an SentryEvent. | ||
* @param stacktrace TraceKitStackTrace to be converted to an Event. | ||
*/ | ||
eventFromGlobalHandler(stacktrace) { | ||
_eventFromGlobalHandler(stacktrace) { | ||
const event = eventFromStacktrace(stacktrace); | ||
@@ -78,20 +79,15 @@ const data = { | ||
} | ||
const newEvent = { | ||
...event, | ||
exception: { | ||
...event.exception, | ||
mechanism: { | ||
data, | ||
handled: false, | ||
type: stacktrace.mechanism, | ||
}, | ||
}, | ||
}; | ||
const fallbackValue = typeof stacktrace.original !== 'undefined' | ||
? `${truncate(serialize(safeNormalize(stacktrace.original)), 300)}` | ||
const client = getCurrentHub().getClient(); | ||
const maxValueLength = (client && client.getOptions().maxValueLength) || 250; | ||
const fallbackValue = stacktrace.original | ||
? truncate(JSON.stringify(normalize(stacktrace.original)), maxValueLength) | ||
: ''; | ||
const fallbackType = stacktrace.mechanism === 'onunhandledrejection' ? 'UnhandledRejection' : 'Error'; | ||
// This makes sure we have type/value in every exception | ||
addExceptionTypeValue(newEvent, fallbackValue, fallbackType); | ||
return newEvent; | ||
addExceptionTypeValue(event, fallbackValue, fallbackType, { | ||
data, | ||
handled: false, | ||
type: stacktrace.mechanism, | ||
}); | ||
return event; | ||
} | ||
@@ -98,0 +94,0 @@ } |
@@ -1,5 +0,9 @@ | ||
import { Mechanism, SentryWrappedFunction } from '@sentry/types/esm'; | ||
/** JSDoc */ | ||
import { Mechanism, WrappedFunction } from '@sentry/types'; | ||
/** | ||
* @hidden | ||
*/ | ||
export declare function shouldIgnoreOnError(): boolean; | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
export declare function ignoreNextOnError(): void; | ||
@@ -12,6 +16,7 @@ /** | ||
* @returns The wrapped function. | ||
* @hidden | ||
*/ | ||
export declare function wrap(fn: SentryWrappedFunction, options?: { | ||
export declare function wrap(fn: WrappedFunction, options?: { | ||
mechanism?: Mechanism; | ||
}, before?: SentryWrappedFunction): any; | ||
}, before?: WrappedFunction): any; | ||
/** | ||
@@ -21,2 +26,3 @@ * Wraps addEventListener to capture UI breadcrumbs | ||
* @returns wrapped breadcrumb events handler | ||
* @hidden | ||
*/ | ||
@@ -27,3 +33,4 @@ export declare function breadcrumbEventHandler(eventName: string): (event: Event) => void; | ||
* @returns wrapped keypress events handler | ||
* @hidden | ||
*/ | ||
export declare function keypressEventHandler(): (event: Event) => void; |
@@ -1,5 +0,4 @@ | ||
import { captureException, getCurrentHub, withScope } from '@sentry/core/esm'; | ||
import { isFunction } from '@sentry/utils/esm/is'; | ||
import { htmlTreeAsString } from '@sentry/utils/esm/misc'; | ||
import { safeNormalize } from '@sentry/utils/esm/object'; | ||
import { captureException, getCurrentHub, withScope } from '@sentry/core'; | ||
import { addExceptionTypeValue, htmlTreeAsString } from '@sentry/utils/misc'; | ||
import { normalize } from '@sentry/utils/object'; | ||
const debounceDuration = 1000; | ||
@@ -9,7 +8,11 @@ let keypressTimeout; | ||
let ignoreOnError = 0; | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
export function shouldIgnoreOnError() { | ||
return ignoreOnError > 0; | ||
} | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
export function ignoreNextOnError() { | ||
@@ -28,5 +31,7 @@ // onerror should trigger before setTimeout | ||
* @returns The wrapped function. | ||
* @hidden | ||
*/ | ||
export function wrap(fn, options = {}, before) { | ||
if (!isFunction(fn)) { | ||
// tslint:disable-next-line:strict-type-predicates | ||
if (typeof fn !== 'function') { | ||
return fn; | ||
@@ -51,3 +56,4 @@ } | ||
const sentryWrapped = function () { | ||
if (before && isFunction(before)) { | ||
// tslint:disable-next-line:strict-type-predicates | ||
if (before && typeof before === 'function') { | ||
before.apply(this, arguments); | ||
@@ -65,19 +71,13 @@ } | ||
} | ||
else { | ||
return fn.apply(this, wrappedArguments); | ||
} | ||
return fn.apply(this, wrappedArguments); | ||
} | ||
catch (ex) { | ||
ignoreNextOnError(); | ||
withScope(async (scope) => { | ||
scope.addEventProcessor(async (event) => { | ||
const processedEvent = { ...event }; | ||
withScope(scope => { | ||
scope.addEventProcessor((event) => { | ||
const processedEvent = Object.assign({}, event); | ||
if (options.mechanism) { | ||
processedEvent.exception = processedEvent.exception || {}; | ||
processedEvent.exception.mechanism = options.mechanism; | ||
addExceptionTypeValue(processedEvent, undefined, undefined, options.mechanism); | ||
} | ||
processedEvent.extra = { | ||
...processedEvent.extra, | ||
arguments: safeNormalize(args, 3), | ||
}; | ||
processedEvent.extra = Object.assign({}, processedEvent.extra, { arguments: normalize(args, 3) }); | ||
return processedEvent; | ||
@@ -135,2 +135,3 @@ }); | ||
* @returns wrapped breadcrumb events handler | ||
* @hidden | ||
*/ | ||
@@ -173,2 +174,3 @@ export function breadcrumbEventHandler(eventName) { | ||
* @returns wrapped keypress events handler | ||
* @hidden | ||
*/ | ||
@@ -175,0 +177,0 @@ export function keypressEventHandler() { |
@@ -6,4 +6,1 @@ export { GlobalHandlers } from './globalhandlers'; | ||
export { UserAgent } from './useragent'; | ||
export { Ember } from './pluggable/ember'; | ||
export { Vue } from './pluggable/vue'; | ||
export { ReportingObserver } from './pluggable/reportingobserver'; |
@@ -6,5 +6,2 @@ export { GlobalHandlers } from './globalhandlers'; | ||
export { UserAgent } from './useragent'; | ||
export { Ember } from './pluggable/ember'; | ||
export { Vue } from './pluggable/vue'; | ||
export { ReportingObserver } from './pluggable/reportingobserver'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,2 @@ | ||
import { Integration, SentryEvent, SentryEventHint, SentryException } from '@sentry/types/esm'; | ||
/** | ||
* Just an Error object with arbitrary attributes attached to it. | ||
*/ | ||
interface ExtendedError extends Error { | ||
[key: string]: any; | ||
} | ||
import { Event, EventHint, Exception, ExtendedError, Integration } from '@sentry/types'; | ||
/** Adds SDK info to an event. */ | ||
@@ -21,7 +15,7 @@ export declare class LinkedErrors implements Integration { | ||
*/ | ||
private readonly key; | ||
private readonly _key; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
private readonly limit; | ||
private readonly _limit; | ||
/** | ||
@@ -41,8 +35,7 @@ * @inheritDoc | ||
*/ | ||
handler(event: SentryEvent, hint?: SentryEventHint): SentryEvent | null; | ||
handler(event: Event, hint?: EventHint): Event | null; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
walkErrorTree(error: ExtendedError, key: string, stack?: SentryException[]): SentryException[]; | ||
walkErrorTree(error: ExtendedError, key: string, stack?: Exception[]): Exception[]; | ||
} | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core/esm'; | ||
import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core'; | ||
import { exceptionFromStacktrace } from '../parsers'; | ||
@@ -16,4 +16,4 @@ import { computeStackTrace } from '../tracekit'; | ||
this.name = LinkedErrors.id; | ||
this.key = options.key || DEFAULT_KEY; | ||
this.limit = options.limit || DEFAULT_LIMIT; | ||
this._key = options.key || DEFAULT_KEY; | ||
this._limit = options.limit || DEFAULT_LIMIT; | ||
} | ||
@@ -24,3 +24,3 @@ /** | ||
setupOnce() { | ||
addGlobalEventProcessor(async (event, hint) => { | ||
addGlobalEventProcessor((event, hint) => { | ||
const self = getCurrentHub().getIntegration(LinkedErrors); | ||
@@ -40,3 +40,3 @@ if (self) { | ||
} | ||
const linkedErrors = this.walkErrorTree(hint.originalException, this.key); | ||
const linkedErrors = this.walkErrorTree(hint.originalException, this._key); | ||
event.exception.values = [...linkedErrors, ...event.exception.values]; | ||
@@ -49,3 +49,3 @@ return event; | ||
walkErrorTree(error, key, stack = []) { | ||
if (!(error[key] instanceof Error) || stack.length + 1 >= this.limit) { | ||
if (!(error[key] instanceof Error) || stack.length + 1 >= this._limit) { | ||
return stack; | ||
@@ -52,0 +52,0 @@ } |
@@ -1,6 +0,6 @@ | ||
import { Integration } from '@sentry/types/esm'; | ||
import { Integration } from '@sentry/types'; | ||
/** Wrap timer functions and event targets to catch errors and provide better meta data */ | ||
export declare class TryCatch implements Integration { | ||
/** JSDoc */ | ||
private ignoreOnError; | ||
private _ignoreOnError; | ||
/** | ||
@@ -15,7 +15,7 @@ * @inheritDoc | ||
/** JSDoc */ | ||
private wrapTimeFunction; | ||
private _wrapTimeFunction; | ||
/** JSDoc */ | ||
private wrapRAF; | ||
private _wrapRAF; | ||
/** JSDoc */ | ||
private wrapEventTarget; | ||
private _wrapEventTarget; | ||
/** | ||
@@ -22,0 +22,0 @@ * Wrap timer functions and event targets to catch errors |
@@ -1,3 +0,3 @@ | ||
import { getGlobalObject } from '@sentry/utils/esm/misc'; | ||
import { fill } from '@sentry/utils/esm/object'; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
import { fill } from '@sentry/utils/object'; | ||
import { breadcrumbEventHandler, keypressEventHandler, wrap } from './helpers'; | ||
@@ -8,3 +8,3 @@ /** Wrap timer functions and event targets to catch errors and provide better meta data */ | ||
/** JSDoc */ | ||
this.ignoreOnError = 0; | ||
this._ignoreOnError = 0; | ||
/** | ||
@@ -16,3 +16,3 @@ * @inheritDoc | ||
/** JSDoc */ | ||
wrapTimeFunction(original) { | ||
_wrapTimeFunction(original) { | ||
return function (...args) { | ||
@@ -31,3 +31,3 @@ const originalCallback = args[0]; | ||
/** JSDoc */ | ||
wrapRAF(original) { | ||
_wrapRAF(original) { | ||
return function (callback) { | ||
@@ -47,3 +47,3 @@ return original(wrap(callback, { | ||
/** JSDoc */ | ||
wrapEventTarget(target) { | ||
_wrapEventTarget(target) { | ||
const global = getGlobalObject(); | ||
@@ -101,3 +101,3 @@ const proto = global[target] && global[target].prototype; | ||
} | ||
else if (eventType === 'keypress') { | ||
if (eventType === 'keypress') { | ||
return keypressHandler(event); | ||
@@ -138,7 +138,7 @@ } | ||
setupOnce() { | ||
this.ignoreOnError = this.ignoreOnError; | ||
this._ignoreOnError = this._ignoreOnError; | ||
const global = getGlobalObject(); | ||
fill(global, 'setTimeout', this.wrapTimeFunction.bind(this)); | ||
fill(global, 'setInterval', this.wrapTimeFunction.bind(this)); | ||
fill(global, 'requestAnimationFrame', this.wrapRAF.bind(this)); | ||
fill(global, 'setTimeout', this._wrapTimeFunction.bind(this)); | ||
fill(global, 'setInterval', this._wrapTimeFunction.bind(this)); | ||
fill(global, 'requestAnimationFrame', this._wrapRAF.bind(this)); | ||
[ | ||
@@ -174,3 +174,3 @@ 'EventTarget', | ||
'XMLHttpRequestUpload', | ||
].forEach(this.wrapEventTarget.bind(this)); | ||
].forEach(this._wrapEventTarget.bind(this)); | ||
} | ||
@@ -177,0 +177,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Integration } from '@sentry/types/esm'; | ||
import { Integration } from '@sentry/types'; | ||
/** UserAgent */ | ||
@@ -3,0 +3,0 @@ export declare class UserAgent implements Integration { |
@@ -1,3 +0,3 @@ | ||
import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core/esm'; | ||
import { getGlobalObject } from '@sentry/utils/esm/misc'; | ||
import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core'; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
const global = getGlobalObject(); | ||
@@ -16,3 +16,3 @@ /** UserAgent */ | ||
setupOnce() { | ||
addGlobalEventProcessor(async (event) => { | ||
addGlobalEventProcessor((event) => { | ||
if (getCurrentHub().getIntegration(UserAgent)) { | ||
@@ -27,6 +27,3 @@ if (!global.navigator || !global.location) { | ||
request.headers['User-Agent'] = global.navigator.userAgent; | ||
return { | ||
...event, | ||
request, | ||
}; | ||
return Object.assign({}, event, { request }); | ||
} | ||
@@ -33,0 +30,0 @@ return event; |
@@ -1,2 +0,2 @@ | ||
import { SentryEvent, SentryException, StackFrame } from '@sentry/types/esm'; | ||
import { Event, Exception, StackFrame } from '@sentry/types'; | ||
import { StackFrame as TraceKitStackFrame, StackTrace as TraceKitStackTrace } from './tracekit'; | ||
@@ -6,16 +6,16 @@ /** | ||
* @param stacktrace TraceKitStackTrace that will be converted to an exception | ||
* @hidden | ||
*/ | ||
export declare function exceptionFromStacktrace(stacktrace: TraceKitStackTrace): SentryException; | ||
/** JSDoc */ | ||
export declare function eventFromPlainObject(exception: {}, syntheticException: Error | null): SentryEvent; | ||
/** JSDoc */ | ||
export declare function eventFromStacktrace(stacktrace: TraceKitStackTrace): SentryEvent; | ||
/** JSDoc */ | ||
export declare function prepareFramesForEvent(stack: TraceKitStackFrame[]): StackFrame[]; | ||
export declare function exceptionFromStacktrace(stacktrace: TraceKitStackTrace): Exception; | ||
/** | ||
* Adds exception values, type and value to an synthetic Exception. | ||
* @param event The event to modify. | ||
* @param value Value of the exception. | ||
* @param type Type of the exception. | ||
* @hidden | ||
*/ | ||
export declare function addExceptionTypeValue(event: SentryEvent, value?: string, type?: string): void; | ||
export declare function eventFromPlainObject(exception: {}, syntheticException: Error | null): Event; | ||
/** | ||
* @hidden | ||
*/ | ||
export declare function eventFromStacktrace(stacktrace: TraceKitStackTrace): Event; | ||
/** | ||
* @hidden | ||
*/ | ||
export declare function prepareFramesForEvent(stack: TraceKitStackFrame[]): StackFrame[]; |
@@ -1,4 +0,3 @@ | ||
import { limitObjectDepthToSize, serializeKeysToEventMessage } from '@sentry/utils/esm/object'; | ||
import { includes } from '@sentry/utils/esm/string'; | ||
import { md5 } from './md5'; | ||
import { normalizeToSize } from '@sentry/utils/object'; | ||
import { keysToEventMessage } from '@sentry/utils/string'; | ||
import { computeStackTrace } from './tracekit'; | ||
@@ -9,2 +8,3 @@ const STACKTRACE_LIMIT = 50; | ||
* @param stacktrace TraceKitStackTrace that will be converted to an exception | ||
* @hidden | ||
*/ | ||
@@ -26,3 +26,5 @@ export function exceptionFromStacktrace(stacktrace) { | ||
} | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
export function eventFromPlainObject(exception, syntheticException) { | ||
@@ -32,6 +34,5 @@ const exceptionKeys = Object.keys(exception).sort(); | ||
extra: { | ||
__serialized__: limitObjectDepthToSize(exception), | ||
__serialized__: normalizeToSize(exception), | ||
}, | ||
fingerprint: [md5(exceptionKeys.join(''))], | ||
message: `Non-Error exception captured with keys: ${serializeKeysToEventMessage(exceptionKeys)}`, | ||
message: `Non-Error exception captured with keys: ${keysToEventMessage(exceptionKeys)}`, | ||
}; | ||
@@ -47,3 +48,5 @@ if (syntheticException) { | ||
} | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
export function eventFromStacktrace(stacktrace) { | ||
@@ -57,3 +60,5 @@ const exception = exceptionFromStacktrace(stacktrace); | ||
} | ||
/** JSDoc */ | ||
/** | ||
* @hidden | ||
*/ | ||
export function prepareFramesForEvent(stack) { | ||
@@ -67,7 +72,7 @@ if (!stack || !stack.length) { | ||
// If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call) | ||
if (includes(firstFrameFunction, 'captureMessage') || includes(firstFrameFunction, 'captureException')) { | ||
if (firstFrameFunction.includes('captureMessage') || firstFrameFunction.includes('captureException')) { | ||
localStack = localStack.slice(1); | ||
} | ||
// If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call) | ||
if (includes(lastFrameFunction, 'sentryWrapped')) { | ||
if (lastFrameFunction.includes('sentryWrapped')) { | ||
localStack = localStack.slice(0, -1); | ||
@@ -87,15 +92,2 @@ } | ||
} | ||
/** | ||
* Adds exception values, type and value to an synthetic Exception. | ||
* @param event The event to modify. | ||
* @param value Value of the exception. | ||
* @param type Type of the exception. | ||
*/ | ||
export function addExceptionTypeValue(event, value, type) { | ||
event.exception = event.exception || {}; | ||
event.exception.values = event.exception.values || []; | ||
event.exception.values[0] = event.exception.values[0] || {}; | ||
event.exception.values[0].value = event.exception.values[0].value || value || ''; | ||
event.exception.values[0].type = event.exception.values[0].type || type || 'Error'; | ||
} | ||
//# sourceMappingURL=parsers.js.map |
@@ -1,6 +0,6 @@ | ||
import { Integrations as CoreIntegrations } from '@sentry/core/esm'; | ||
import { Integrations as CoreIntegrations } from '@sentry/core'; | ||
import { BrowserOptions } from './backend'; | ||
import { ReportDialogOptions } from './client'; | ||
import { Breadcrumbs, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations'; | ||
export declare const defaultIntegrations: (CoreIntegrations.Dedupe | CoreIntegrations.FunctionToString | CoreIntegrations.InboundFilters | CoreIntegrations.ExtraErrorData | GlobalHandlers | TryCatch | Breadcrumbs | LinkedErrors | UserAgent)[]; | ||
export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | CoreIntegrations.InboundFilters | GlobalHandlers | TryCatch | Breadcrumbs | LinkedErrors | UserAgent)[]; | ||
/** | ||
@@ -14,4 +14,7 @@ * The Sentry Browser SDK Client. | ||
* @example | ||
* import { init } from '@sentry/browser/esm'; | ||
* | ||
* ``` | ||
* | ||
* import { init } from '@sentry/browser'; | ||
* | ||
* init({ | ||
@@ -21,5 +24,8 @@ * dsn: '__DSN__', | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* import { configureScope } from '@sentry/browser/esm'; | ||
* ``` | ||
* | ||
* import { configureScope } from '@sentry/browser'; | ||
* configureScope((scope: Scope) => { | ||
@@ -30,5 +36,8 @@ * scope.setExtra({ battery: 0.7 }); | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* import { addBreadcrumb } from '@sentry/browser/esm'; | ||
* ``` | ||
* | ||
* import { addBreadcrumb } from '@sentry/browser'; | ||
* addBreadcrumb({ | ||
@@ -38,4 +47,8 @@ * message: 'My Breadcrumb', | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* | ||
* ``` | ||
* | ||
* import * as Sentry from '@sentry/browser'; | ||
@@ -50,4 +63,5 @@ * Sentry.captureMessage('Hello, world!'); | ||
* }); | ||
* ``` | ||
* | ||
* @see BrowserOptions for documentation on configuration options. | ||
* @see {@link BrowserOptions} for documentation on configuration options. | ||
*/ | ||
@@ -68,7 +82,9 @@ export declare function init(options?: BrowserOptions): void; | ||
/** | ||
* This function is here to be API compatible with the loader | ||
* This function is here to be API compatible with the loader. | ||
* @hidden | ||
*/ | ||
export declare function forceLoad(): void; | ||
/** | ||
* This function is here to be API compatible with the loader | ||
* This function is here to be API compatible with the loader. | ||
* @hidden | ||
*/ | ||
@@ -75,0 +91,0 @@ export declare function onLoad(callback: () => void): void; |
@@ -1,16 +0,11 @@ | ||
import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@sentry/core/esm'; | ||
import * as tslib_1 from "tslib"; | ||
import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@sentry/core'; | ||
import { BrowserClient } from './client'; | ||
import { Breadcrumbs, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations'; | ||
export const defaultIntegrations = [ | ||
// Common | ||
new CoreIntegrations.Dedupe(), | ||
new CoreIntegrations.InboundFilters(), | ||
new CoreIntegrations.FunctionToString(), | ||
new CoreIntegrations.ExtraErrorData(), | ||
// Native Wrappers | ||
new TryCatch(), | ||
new Breadcrumbs(), | ||
// Global Handlers | ||
new GlobalHandlers(), | ||
// Misc | ||
new LinkedErrors(), | ||
@@ -27,4 +22,7 @@ new UserAgent(), | ||
* @example | ||
* import { init } from '@sentry/browser/esm'; | ||
* | ||
* ``` | ||
* | ||
* import { init } from '@sentry/browser'; | ||
* | ||
* init({ | ||
@@ -34,5 +32,8 @@ * dsn: '__DSN__', | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* import { configureScope } from '@sentry/browser/esm'; | ||
* ``` | ||
* | ||
* import { configureScope } from '@sentry/browser'; | ||
* configureScope((scope: Scope) => { | ||
@@ -43,5 +44,8 @@ * scope.setExtra({ battery: 0.7 }); | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* import { addBreadcrumb } from '@sentry/browser/esm'; | ||
* ``` | ||
* | ||
* import { addBreadcrumb } from '@sentry/browser'; | ||
* addBreadcrumb({ | ||
@@ -51,4 +55,8 @@ * message: 'My Breadcrumb', | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* | ||
* ``` | ||
* | ||
* import * as Sentry from '@sentry/browser'; | ||
@@ -63,4 +71,5 @@ * Sentry.captureMessage('Hello, world!'); | ||
* }); | ||
* ``` | ||
* | ||
* @see BrowserOptions for documentation on configuration options. | ||
* @see {@link BrowserOptions} for documentation on configuration options. | ||
*/ | ||
@@ -82,3 +91,6 @@ export function init(options = {}) { | ||
} | ||
getCurrentHub().getClient().showReportDialog(options); | ||
const client = getCurrentHub().getClient(); | ||
if (client) { | ||
client.showReportDialog(options); | ||
} | ||
} | ||
@@ -94,3 +106,4 @@ /** | ||
/** | ||
* This function is here to be API compatible with the loader | ||
* This function is here to be API compatible with the loader. | ||
* @hidden | ||
*/ | ||
@@ -101,3 +114,4 @@ export function forceLoad() { | ||
/** | ||
* This function is here to be API compatible with the loader | ||
* This function is here to be API compatible with the loader. | ||
* @hidden | ||
*/ | ||
@@ -113,4 +127,10 @@ export function onLoad(callback) { | ||
*/ | ||
export async function flush(timeout) { | ||
return getCurrentHub().getClient().flush(timeout); | ||
export function flush(timeout) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const client = getCurrentHub().getClient(); | ||
if (client) { | ||
return client.flush(timeout); | ||
} | ||
return Promise.reject(false); | ||
}); | ||
} | ||
@@ -123,5 +143,11 @@ /** | ||
*/ | ||
export async function close(timeout) { | ||
return getCurrentHub().getClient().close(timeout); | ||
export function close(timeout) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const client = getCurrentHub().getClient(); | ||
if (client) { | ||
return client.close(timeout); | ||
} | ||
return Promise.reject(false); | ||
}); | ||
} | ||
//# sourceMappingURL=sdk.js.map |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
export interface StackFrame { | ||
@@ -9,2 +12,5 @@ url: string; | ||
} | ||
/** | ||
* @hidden | ||
*/ | ||
export interface StackTrace { | ||
@@ -30,67 +36,3 @@ /** | ||
(ex: Error, depth?: string | number): StackTrace; | ||
/** | ||
* Adds information about the first frame to incomplete stack traces. | ||
* Safari and IE require this to get complete data on the first frame. | ||
* @param {Object.<string, *>} stackInfo Stack trace information from | ||
* one of the compute* methods. | ||
* @param {string} url The URL of the script that caused an error. | ||
* @param {(number|string)} lineNo The line number of the script that | ||
* caused an error. | ||
* @param {string=} message The error generated by the browser, which | ||
* hopefully contains the name of the object that caused the error. | ||
* @return {boolean} Whether or not the stack information was | ||
* augmented. | ||
*/ | ||
augmentStackTraceWithInitialElement: (stackInfo: string, url: string, lineNo: string | number, message?: string) => boolean; | ||
/** | ||
* Tries to use an externally loaded copy of source code to determine | ||
* the name of a function by looking at the name of the variable it was | ||
* assigned to, if any. | ||
* @param {string} url URL of source code. | ||
* @param {(string|number)} lineNo Line number in source code. | ||
* @return {string} The function name, if discoverable. | ||
*/ | ||
guessFunctionName: (url: string, lineNo: string | number) => string; | ||
/** | ||
* Retrieves the surrounding lines from where an exception occurred. | ||
* @param {string} url URL of source code. | ||
* @param {(string|number)} line Line number in source code to centre | ||
* around for context. | ||
* @return {?Array.<string>} Lines of source code. | ||
*/ | ||
gatherContext: (url: string, line: string | number) => string[]; | ||
/** | ||
* Logs a stacktrace starting from the previous call and working down. | ||
* @param {(number|string)=} depth How many frames deep to trace. | ||
* @return {Object.<string, *>} Stack trace information. | ||
*/ | ||
ofCaller: (depth?: string | number) => StackTrace; | ||
/** | ||
* Retrieves source code from the source code cache. | ||
* @param {string} url URL of source code. | ||
* @return {Array.<string>} Source contents. | ||
*/ | ||
getSource: (url: string) => string[]; | ||
} | ||
interface ReportSubscriber { | ||
(stackTrace: StackTrace, isWindowError: boolean, error: any): void; | ||
} | ||
interface Report { | ||
/** | ||
* Reports an unhandled Error to TraceKit. | ||
* @param {Error} ex | ||
*/ | ||
(ex: Error): void; | ||
/** | ||
* Add a crash handler. | ||
* @param {Function} handler | ||
*/ | ||
subscribe(handler: ReportSubscriber): void; | ||
/** | ||
* Remove a crash handler. | ||
* @param {Function} handler | ||
*/ | ||
unsubscribe(handler: ReportSubscriber): void; | ||
} | ||
declare const report: Report; | ||
declare const subscribe: any; | ||
@@ -100,2 +42,2 @@ declare const installGlobalHandler: any; | ||
declare const computeStackTrace: ComputeStackTrace; | ||
export { report, subscribe, installGlobalHandler, installGlobalUnhandledRejectionHandler, computeStackTrace }; | ||
export { subscribe, installGlobalHandler, installGlobalUnhandledRejectionHandler, computeStackTrace }; |
// tslint:disable | ||
import { isUndefined, isError, isErrorEvent } from '@sentry/utils/esm/is'; | ||
import { getGlobalObject } from '@sentry/utils/esm/misc'; | ||
import { isError, isErrorEvent } from '@sentry/utils/is'; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
/** | ||
@@ -19,9 +19,6 @@ * TraceKit - Cross brower stack traces | ||
var TraceKit = { | ||
wrap: () => () => { }, | ||
report: false, | ||
collectWindowErrors: false, | ||
computeStackTrace: false, | ||
remoteFetching: false, | ||
linesOfContext: false, | ||
extendToAsynchronousCallbacks: false, | ||
}; | ||
@@ -31,3 +28,2 @@ // var TraceKit: TraceKitInterface = {}; | ||
// global reference to slice | ||
var _slice = [].slice; | ||
var UNKNOWN_FUNCTION = '?'; | ||
@@ -58,40 +54,2 @@ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types | ||
/** | ||
* A safe form of location.origin<br/> | ||
* | ||
* @return {string} location.origin | ||
*/ | ||
function getLocationOrigin() { | ||
if (typeof document === 'undefined' || document.location == null) | ||
return ''; | ||
// Oh dear IE10... | ||
if (!document.location.origin) { | ||
return (document.location.protocol + | ||
'//' + | ||
document.location.hostname + | ||
(document.location.port ? ':' + document.location.port : '')); | ||
} | ||
return document.location.origin; | ||
} | ||
/** | ||
* Wrap any function in a TraceKit reporter<br/> | ||
* Example: `func = TraceKit.wrap(func);` | ||
* | ||
* @param {Function} func Function to be wrapped | ||
* @return {Function} The wrapped func | ||
* @memberof TraceKit | ||
*/ | ||
TraceKit.wrap = function traceKitWrapper(func) { | ||
function wrapped() { | ||
try { | ||
// @ts-ignore | ||
return func.apply(this, arguments); | ||
} | ||
catch (e) { | ||
TraceKit.report(e); | ||
throw e; | ||
} | ||
} | ||
return wrapped; | ||
}; | ||
/** | ||
* Cross-browser processing of unhandled exceptions | ||
@@ -102,3 +60,2 @@ * | ||
* TraceKit.report.subscribe(function(stackInfo) { ... }) | ||
* TraceKit.report.unsubscribe(function(stackInfo) { ... }) | ||
* TraceKit.report(exception) | ||
@@ -156,18 +113,2 @@ * try { ...code... } catch(ex) { TraceKit.report(ex); } | ||
/** | ||
* Remove a crash handler. | ||
* @param {Function} handler | ||
* @memberof TraceKit.report | ||
*/ | ||
function unsubscribe(handler) { | ||
for (var i = handlers.length - 1; i >= 0; --i) { | ||
if (handlers[i] === handler) { | ||
handlers.splice(i, 1); | ||
} | ||
} | ||
if (handlers.length === 0) { | ||
uninstallGlobalHandler(); | ||
uninstallGlobalUnhandledRejectionHandler(); | ||
} | ||
} | ||
/** | ||
* Dispatch stack information to all handlers. | ||
@@ -200,3 +141,2 @@ * @param {TraceKit.StackTrace} stack | ||
var _oldOnerrorHandler, _onErrorHandlerInstalled; | ||
var _oldOnunhandledrejectionHandler, _onUnhandledRejectionHandlerInstalled; | ||
/** | ||
@@ -242,4 +182,4 @@ * Ensures all global unhandled exceptions are recorded. | ||
} | ||
location.func = TraceKit.computeStackTrace.guessFunctionName(location.url, location.line); | ||
location.context = TraceKit.computeStackTrace.gatherContext(location.url, location.line); | ||
location.func = UNKNOWN_FUNCTION; | ||
location.context = null; | ||
stack = { | ||
@@ -251,9 +191,7 @@ name: name, | ||
stack: [ | ||
{ | ||
...location, | ||
Object.assign({}, location, { | ||
// Firefox sometimes doesn't return url correctly and this is an old behavior | ||
// that I prefer to port here as well. | ||
// It can be altered only here, as previously it's using `location.url` for other things — Kamil | ||
url: location.url || getLocationHref(), | ||
}, | ||
url: location.url || getLocationHref() }), | ||
], | ||
@@ -295,12 +233,2 @@ }; | ||
/** | ||
* Uninstall the global onerror handler | ||
* @memberof TraceKit.report | ||
*/ | ||
function uninstallGlobalHandler() { | ||
if (_onErrorHandlerInstalled) { | ||
window.onerror = _oldOnerrorHandler; | ||
_onErrorHandlerInstalled = false; | ||
} | ||
} | ||
/** | ||
* Install a global onunhandledrejection handler | ||
@@ -310,20 +238,5 @@ * @memberof TraceKit.report | ||
function installGlobalUnhandledRejectionHandler() { | ||
if (_onUnhandledRejectionHandlerInstalled === true) { | ||
return; | ||
} | ||
_oldOnunhandledrejectionHandler = window.onunhandledrejection; | ||
window.onunhandledrejection = traceKitWindowOnUnhandledRejection; | ||
_onUnhandledRejectionHandlerInstalled = true; | ||
} | ||
/** | ||
* Uninstall the global onunhandledrejection handler | ||
* @memberof TraceKit.report | ||
*/ | ||
function uninstallGlobalUnhandledRejectionHandler() { | ||
if (_onUnhandledRejectionHandlerInstalled) { | ||
window.onunhandledrejection = _oldOnunhandledrejectionHandler; | ||
_onUnhandledRejectionHandlerInstalled = false; | ||
} | ||
} | ||
/** | ||
* Process the most recent exception | ||
@@ -368,3 +281,2 @@ * @memberof TraceKit.report | ||
report.subscribe = subscribe; | ||
report.unsubscribe = unsubscribe; | ||
report.installGlobalHandler = installGlobalHandler; | ||
@@ -399,3 +311,2 @@ report.installGlobalUnhandledRejectionHandler = installGlobalUnhandledRejectionHandler; | ||
* ```js | ||
* s = TraceKit.computeStackTrace.ofCaller([depth]) | ||
* s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below) | ||
@@ -440,17 +351,2 @@ * ``` | ||
* | ||
* Tracing example: | ||
* ```js | ||
* function trace(message) { | ||
* var stackInfo = TraceKit.computeStackTrace.ofCaller(); | ||
* var data = message + "\n"; | ||
* for(var i in stackInfo.stack) { | ||
* var item = stackInfo.stack[i]; | ||
* data += (item.func || '[anonymous]') + "() in " + item.url + ":" + (item.line || '0') + "\n"; | ||
* } | ||
* if (window.console) | ||
* console.info(data); | ||
* else | ||
* alert(data); | ||
* } | ||
* ``` | ||
* @memberof TraceKit | ||
@@ -460,242 +356,2 @@ * @namespace | ||
TraceKit.computeStackTrace = (function computeStackTraceWrapper() { | ||
var debug = false, sourceCache = {}; | ||
/** | ||
* Attempts to retrieve source code via XMLHttpRequest, which is used | ||
* to look up anonymous function names. | ||
* @param {string} url URL of source code. | ||
* @return {string} Source contents. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function loadSource(url) { | ||
if (!TraceKit.remoteFetching) { | ||
//Only attempt request if remoteFetching is on. | ||
return ''; | ||
} | ||
try { | ||
var getXHR = function () { | ||
try { | ||
return new window.XMLHttpRequest(); | ||
} | ||
catch (e) { | ||
// explicitly bubble up the exception if not found | ||
return new window.ActiveXObject('Microsoft.XMLHTTP'); | ||
} | ||
}; | ||
var request = getXHR(); | ||
request.open('GET', url, false); | ||
request.send(''); | ||
return request.responseText; | ||
} | ||
catch (e) { | ||
return ''; | ||
} | ||
} | ||
/** | ||
* Retrieves source code from the source code cache. | ||
* @param {string} url URL of source code. | ||
* @return {Array.<string>} Source contents. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function getSource(url) { | ||
if (typeof url !== 'string') { | ||
return []; | ||
} | ||
if (!_has(sourceCache, url)) { | ||
// URL needs to be able to fetched within the acceptable domain. Otherwise, | ||
// cross-domain errors will be triggered. | ||
/* | ||
Regex matches: | ||
0 - Full Url | ||
1 - Protocol | ||
2 - Domain | ||
3 - Port (Useful for internal applications) | ||
4 - Path | ||
*/ | ||
var source = ''; | ||
var domain = ''; | ||
try { | ||
domain = window.document.domain; | ||
} | ||
catch (e) { } | ||
var match = /(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(url); | ||
if (match && match[2] === domain) { | ||
source = loadSource(url); | ||
} | ||
sourceCache[url] = source ? source.split('\n') : []; | ||
} | ||
return sourceCache[url]; | ||
} | ||
/** | ||
* Tries to use an externally loaded copy of source code to determine | ||
* the name of a function by looking at the name of the variable it was | ||
* assigned to, if any. | ||
* @param {string} url URL of source code. | ||
* @param {(string|number)} lineNo Line number in source code. | ||
* @return {string} The function name, if discoverable. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function guessFunctionName(url, lineNo) { | ||
var reFunctionArgNames = /function ([^(]*)\(([^)]*)\)/, reGuessFunction = /['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/, line = '', maxLines = 10, source = getSource(url), m; | ||
if (!source.length) { | ||
return UNKNOWN_FUNCTION; | ||
} | ||
// Walk backwards from the first line in the function until we find the line which | ||
// matches the pattern above, which is the function definition | ||
for (var i = 0; i < maxLines; ++i) { | ||
line = source[lineNo - i] + line; | ||
if (!isUndefined(line)) { | ||
if ((m = reGuessFunction.exec(line))) { | ||
return m[1]; | ||
} | ||
else if ((m = reFunctionArgNames.exec(line))) { | ||
return m[1]; | ||
} | ||
} | ||
} | ||
return UNKNOWN_FUNCTION; | ||
} | ||
/** | ||
* Retrieves the surrounding lines from where an exception occurred. | ||
* @param {string} url URL of source code. | ||
* @param {(string|number)} line Line number in source code to center around for context. | ||
* @return {?Array.<string>} Lines of source code. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function gatherContext(url, line) { | ||
var source = getSource(url); | ||
if (!source.length) { | ||
return null; | ||
} | ||
var context = [], | ||
// linesBefore & linesAfter are inclusive with the offending line. | ||
// if linesOfContext is even, there will be one extra line | ||
// *before* the offending line. | ||
linesBefore = Math.floor(TraceKit.linesOfContext / 2), | ||
// Add one extra line if linesOfContext is odd | ||
linesAfter = linesBefore + (TraceKit.linesOfContext % 2), start = Math.max(0, line - linesBefore - 1), end = Math.min(source.length, line + linesAfter - 1); | ||
line -= 1; // convert to 0-based index | ||
for (var i = start; i < end; ++i) { | ||
if (!isUndefined(source[i])) { | ||
context.push(source[i]); | ||
} | ||
} | ||
return context.length > 0 ? context : null; | ||
} | ||
/** | ||
* Escapes special characters, except for whitespace, in a string to be | ||
* used inside a regular expression as a string literal. | ||
* @param {string} text The string. | ||
* @return {string} The escaped string literal. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function escapeRegExp(text) { | ||
return text.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g, '\\$&'); | ||
} | ||
/** | ||
* Escapes special characters in a string to be used inside a regular | ||
* expression as a string literal. Also ensures that HTML entities will | ||
* be matched the same as their literal friends. | ||
* @param {string} body The string. | ||
* @return {string} The escaped string. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function escapeCodeAsRegExpForMatchingInsideHTML(body) { | ||
return escapeRegExp(body) | ||
.replace('<', '(?:<|<)') | ||
.replace('>', '(?:>|>)') | ||
.replace('&', '(?:&|&)') | ||
.replace('"', '(?:"|")') | ||
.replace(/\s+/g, '\\s+'); | ||
} | ||
/** | ||
* Determines where a code fragment occurs in the source code. | ||
* @param {RegExp} re The function definition. | ||
* @param {Array.<string>} urls A list of URLs to search. | ||
* @return {?Object.<string, (string|number)>} An object containing | ||
* the url, line, and column number of the defined function. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function findSourceInUrls(re, urls) { | ||
var source, m; | ||
for (var i = 0, j = urls.length; i < j; ++i) { | ||
if ((source = getSource(urls[i])).length) { | ||
source = source.join('\n'); | ||
if ((m = re.exec(source))) { | ||
return { | ||
url: urls[i], | ||
line: source.substring(0, m.index).split('\n').length, | ||
column: m.index - source.lastIndexOf('\n', m.index) - 1, | ||
}; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
/** | ||
* Determines at which column a code fragment occurs on a line of the | ||
* source code. | ||
* @param {string} fragment The code fragment. | ||
* @param {string} url The URL to search. | ||
* @param {(string|number)} line The line number to examine. | ||
* @return {?number} The column number. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function findSourceInLine(fragment, url, line) { | ||
var source = getSource(url), re = new RegExp('\\b' + escapeRegExp(fragment) + '\\b'), m; | ||
line -= 1; | ||
if (source && source.length > line && (m = re.exec(source[line]))) { | ||
return m.index; | ||
} | ||
return null; | ||
} | ||
/** | ||
* Determines where a function was defined within the source code. | ||
* @param {(Function|string)} func A function reference or serialized | ||
* function definition. | ||
* @return {?Object.<string, (string|number)>} An object containing | ||
* the url, line, and column number of the defined function. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function findSourceByFunctionBody(func) { | ||
if (isUndefined(window && window.document)) { | ||
return; | ||
} | ||
var urls = [getLocationHref()], scripts = window.document.getElementsByTagName('script'), body, code = '' + func, codeRE = /^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/, eventRE = /^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/, re, parts, result; | ||
for (var i = 0; i < scripts.length; ++i) { | ||
var script = scripts[i]; | ||
if (script.src) { | ||
urls.push(script.src); | ||
} | ||
} | ||
if (!(parts = codeRE.exec(code))) { | ||
re = new RegExp(escapeRegExp(code).replace(/\s+/g, '\\s+')); | ||
} | ||
// not sure if this is really necessary, but I don’t have a test | ||
// corpus large enough to confirm that and it was in the original. | ||
else { | ||
var name = parts[1] ? '\\s+' + parts[1] : '', args = parts[2].split(',').join('\\s*,\\s*'); | ||
body = escapeRegExp(parts[3]).replace(/;$/, ';?'); // semicolon is inserted if the function ends with a comment.replace(/\s+/g, '\\s+'); | ||
re = new RegExp('function' + name + '\\s*\\(\\s*' + args + '\\s*\\)\\s*{\\s*' + body + '\\s*}'); | ||
} | ||
// look for a normal function definition | ||
if ((result = findSourceInUrls(re, urls))) { | ||
return result; | ||
} | ||
// look for an old-school event handler function | ||
if ((parts = eventRE.exec(code))) { | ||
var event = parts[1]; | ||
body = escapeCodeAsRegExpForMatchingInsideHTML(parts[2]); | ||
// look for a function defined in HTML as an onXXX handler | ||
re = new RegExp('on' + event + '=[\\\'"]\\s*' + body + '\\s*[\\\'"]', 'i'); | ||
if ((result = findSourceInUrls(re, urls[0]))) { | ||
return result; | ||
} | ||
// look for ??? | ||
re = new RegExp(body); | ||
if ((result = findSourceInUrls(re, urls))) { | ||
return result; | ||
} | ||
} | ||
return null; | ||
} | ||
// Contents of Exception in various browsers. | ||
@@ -788,3 +444,3 @@ // | ||
} | ||
else if (i === 0 && !parts[5] && !isUndefined(ex.columnNumber)) { | ||
else if (i === 0 && !parts[5] && ex.columnNumber !== void 0) { | ||
// FireFox uses this awesome columnNumber property for its top frame | ||
@@ -808,36 +464,5 @@ // Also note, Firefox's column number is 0-based and everything else expects 1-based, | ||
if (!element.func && element.line) { | ||
element.func = guessFunctionName(element.url, element.line); | ||
element.func = UNKNOWN_FUNCTION; | ||
} | ||
if (TraceKit.remoteFetching && element.url && element.url.substr(0, 5) === 'blob:') { | ||
// Special case for handling JavaScript loaded into a blob. | ||
// We use a synchronous AJAX request here as a blob is already in | ||
// memory - it's not making a network request. This will generate a warning | ||
// in the browser console, but there has already been an error so that's not | ||
// that much of an issue. | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('GET', element.url, false); | ||
xhr.send(''); | ||
// If we failed to download the source, skip this patch | ||
if (xhr.status === 200) { | ||
var source = xhr.responseText || ''; | ||
// We trim the source down to the last 300 characters as sourceMappingURL is always at the end of the file. | ||
// Why 300? To be in line with: https://github.com/getsentry/sentry/blob/4af29e8f2350e20c28a6933354e4f42437b4ba42/src/sentry/lang/javascript/processor.py#L164-L175 | ||
source = source.slice(-300); | ||
// Now we dig out the source map URL | ||
var sourceMaps = source.match(/\/\/# sourceMappingURL=(.*)$/); | ||
// If we don't find a source map comment or we find more than one, continue on to the next element. | ||
if (sourceMaps) { | ||
var sourceMapAddress = sourceMaps[1]; | ||
// Now we check to see if it's a relative URL. | ||
// If it is, convert it to an absolute one. | ||
if (sourceMapAddress.charAt(0) === '~') { | ||
sourceMapAddress = getLocationOrigin() + sourceMapAddress.slice(1); | ||
} | ||
// Now we strip the '.map' off of the end of the URL and update the | ||
// element so that Sentry can match the map to the blob. | ||
element.url = sourceMapAddress.slice(0, -4); | ||
} | ||
} | ||
} | ||
element.context = element.line ? gatherContext(element.url, element.line) : null; | ||
element.context = null; | ||
stack.push(element); | ||
@@ -849,3 +474,3 @@ } | ||
if (stack[0] && stack[0].line && !stack[0].column && reference) { | ||
stack[0].column = findSourceInLine(reference[1], stack[0].url, stack[0].line); | ||
stack[0].column = null; | ||
} | ||
@@ -897,9 +522,6 @@ return { | ||
if (!element.func && element.line) { | ||
element.func = guessFunctionName(element.url, element.line); | ||
element.func = UNKNOWN_FUNCTION; | ||
} | ||
if (element.line) { | ||
try { | ||
element.context = gatherContext(element.url, element.line); | ||
} | ||
catch (exc) { } | ||
element.context = null; | ||
} | ||
@@ -976,19 +598,5 @@ if (!element.context) { | ||
}; | ||
var relativeLine = +parts[1]; // relative to the start of the <SCRIPT> block | ||
var script = inlineScriptBlocks[parts[2] - 1]; | ||
if (script) { | ||
var source = getSource(item.url); | ||
if (source) { | ||
source = source.join('\n'); | ||
var pos = source.indexOf(script.innerText); | ||
if (pos >= 0) { | ||
item.line = relativeLine + source.substring(0, pos).split('\n').length; | ||
} | ||
} | ||
} | ||
} | ||
else if ((parts = lineRE3.exec(lines[line]))) { | ||
var url = getLocationHref().replace(/#.*$/, ''); | ||
var re = new RegExp(escapeCodeAsRegExpForMatchingInsideHTML(lines[line + 1])); | ||
var src = findSourceInUrls(re, [url]); | ||
item = { | ||
@@ -998,3 +606,3 @@ url: url, | ||
args: [], | ||
line: src ? src.line : parts[1], | ||
line: parts[1], | ||
column: null, | ||
@@ -1005,13 +613,6 @@ }; | ||
if (!item.func) { | ||
item.func = guessFunctionName(item.url, item.line); | ||
item.func = UNKNOWN_FUNCTION; | ||
} | ||
var context = gatherContext(item.url, item.line); | ||
var midline = context ? context[Math.floor(context.length / 2)] : null; | ||
if (context && midline.replace(/^\s*/, '') === lines[line + 1].replace(/^\s*/, '')) { | ||
item.context = context; | ||
} | ||
else { | ||
// if (context) alert("Context mismatch. Correct midline:\n" + lines[i+1] + "\n\nMidline:\n" + midline + "\n\nContext:\n" + context.join("\n") + "\n\nURL:\n" + item.url); | ||
item.context = [lines[line + 1]]; | ||
} | ||
// if (context) alert("Context mismatch. Correct midline:\n" + lines[i+1] + "\n\nMidline:\n" + midline + "\n\nContext:\n" + context.join("\n") + "\n\nURL:\n" + item.url); | ||
item.context = [lines[line + 1]]; | ||
stack.push(item); | ||
@@ -1052,10 +653,10 @@ } | ||
if (!initial.func) { | ||
initial.func = guessFunctionName(initial.url, initial.line); | ||
initial.func = UNKNOWN_FUNCTION; | ||
} | ||
if (!initial.context) { | ||
initial.context = gatherContext(initial.url, initial.line); | ||
initial.context = null; | ||
} | ||
var reference = / '([^']+)' /.exec(message); | ||
if (reference) { | ||
initial.column = findSourceInLine(reference[1], initial.url, initial.line); | ||
initial.column = null; | ||
} | ||
@@ -1094,3 +695,3 @@ if (stackInfo.stack.length > 0) { | ||
function computeStackTraceByWalkingCallerChain(ex, depth) { | ||
var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i, stack = [], funcs = {}, recursion = false, parts, item, source; | ||
var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i, stack = [], funcs = {}, recursion = false, parts, item; | ||
for (var curr = computeStackTraceByWalkingCallerChain.caller; curr && !recursion; curr = curr.caller) { | ||
@@ -1119,13 +720,2 @@ if (curr === computeStackTrace || curr === TraceKit.report) { | ||
} | ||
if ((source = findSourceByFunctionBody(curr))) { | ||
item.url = source.url; | ||
item.line = source.line; | ||
if (item.func === UNKNOWN_FUNCTION) { | ||
item.func = guessFunctionName(item.url, item.line); | ||
} | ||
var reference = / '([^']+)' /.exec(ex.message || ex.description); | ||
if (reference) { | ||
item.column = findSourceInLine(reference[1], source.url, source.line); | ||
} | ||
} | ||
if (funcs['' + curr]) { | ||
@@ -1169,7 +759,3 @@ recursion = true; | ||
} | ||
catch (e) { | ||
if (debug) { | ||
throw e; | ||
} | ||
} | ||
catch (e) { } | ||
try { | ||
@@ -1181,7 +767,3 @@ stack = computeStackTraceFromStackProp(ex); | ||
} | ||
catch (e) { | ||
if (debug) { | ||
throw e; | ||
} | ||
} | ||
catch (e) { } | ||
try { | ||
@@ -1193,7 +775,3 @@ stack = computeStackTraceFromOperaMultiLineMessage(ex); | ||
} | ||
catch (e) { | ||
if (debug) { | ||
throw e; | ||
} | ||
} | ||
catch (e) { } | ||
try { | ||
@@ -1205,7 +783,3 @@ stack = computeStackTraceByWalkingCallerChain(ex, depth + 1); | ||
} | ||
catch (e) { | ||
if (debug) { | ||
throw e; | ||
} | ||
} | ||
catch (e) { } | ||
return { | ||
@@ -1218,58 +792,8 @@ original: ex, | ||
} | ||
/** | ||
* Logs a stacktrace starting from the previous call and working down. | ||
* @param {(number|string)=} depth How many frames deep to trace. | ||
* @return {TraceKit.StackTrace} Stack trace information. | ||
* @memberof TraceKit.computeStackTrace | ||
*/ | ||
function computeStackTraceOfCaller(depth) { | ||
depth = (depth == null ? 0 : +depth) + 1; // "+ 1" because "ofCaller" should drop one frame | ||
try { | ||
throw new Error(); | ||
} | ||
catch (ex) { | ||
return computeStackTrace(ex, depth + 1); | ||
} | ||
} | ||
computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement; | ||
computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp; | ||
computeStackTrace.guessFunctionName = guessFunctionName; | ||
computeStackTrace.gatherContext = gatherContext; | ||
computeStackTrace.ofCaller = computeStackTraceOfCaller; | ||
computeStackTrace.getSource = getSource; | ||
return computeStackTrace; | ||
})(); | ||
/** | ||
* Extends support for global error handling for asynchronous browser | ||
* functions. Adopted from Closure Library's errorhandler.js | ||
* @memberof TraceKit | ||
*/ | ||
TraceKit.extendToAsynchronousCallbacks = function () { | ||
var _helper = function _helper(fnName) { | ||
var originalFn = window[fnName]; | ||
window[fnName] = function traceKitAsyncExtension() { | ||
// Make a copy of the arguments | ||
var args = _slice.call(arguments); | ||
var originalCallback = args[0]; | ||
if (typeof originalCallback === 'function') { | ||
args[0] = TraceKit.wrap(originalCallback); | ||
} | ||
// IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it | ||
// also only supports 2 argument and doesn't care what "this" is, so we | ||
// can just call the original function directly. | ||
if (originalFn.apply) { | ||
return originalFn.apply(this, args); | ||
} | ||
else { | ||
return originalFn(args[0], args[1]); | ||
} | ||
}; | ||
}; | ||
_helper('setTimeout'); | ||
_helper('setInterval'); | ||
}; | ||
TraceKit.remoteFetching = false; | ||
TraceKit.collectWindowErrors = true; | ||
TraceKit.linesOfContext = 11; | ||
const report = TraceKit.report; | ||
const subscribe = TraceKit.report.subscribe; | ||
@@ -1279,3 +803,3 @@ const installGlobalHandler = TraceKit.report.installGlobalHandler; | ||
const computeStackTrace = TraceKit.computeStackTrace; | ||
export { report, subscribe, installGlobalHandler, installGlobalUnhandledRejectionHandler, computeStackTrace }; | ||
export { subscribe, installGlobalHandler, installGlobalUnhandledRejectionHandler, computeStackTrace }; | ||
//# sourceMappingURL=tracekit.js.map |
@@ -1,3 +0,3 @@ | ||
import { PromiseBuffer } from '@sentry/core/esm'; | ||
import { SentryResponse, Transport, TransportOptions } from '@sentry/types/esm'; | ||
import { Event, Response, Transport, TransportOptions } from '@sentry/types'; | ||
import { PromiseBuffer } from '@sentry/utils/promisebuffer'; | ||
/** Base Transport class implementation */ | ||
@@ -11,3 +11,3 @@ export declare abstract class BaseTransport implements Transport { | ||
/** A simple buffer holding all requests. */ | ||
protected readonly buffer: PromiseBuffer<SentryResponse>; | ||
protected readonly _buffer: PromiseBuffer<Response>; | ||
constructor(options: TransportOptions); | ||
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
sendEvent(_: string): Promise<SentryResponse>; | ||
sendEvent(_: Event): Promise<Response>; | ||
/** | ||
@@ -20,0 +20,0 @@ * @inheritDoc |
@@ -1,2 +0,5 @@ | ||
import { API, PromiseBuffer, SentryError } from '@sentry/core/esm'; | ||
import * as tslib_1 from "tslib"; | ||
import { API } from '@sentry/core'; | ||
import { SentryError } from '@sentry/utils/error'; | ||
import { PromiseBuffer } from '@sentry/utils/promisebuffer'; | ||
/** Base Transport class implementation */ | ||
@@ -7,3 +10,3 @@ export class BaseTransport { | ||
/** A simple buffer holding all requests. */ | ||
this.buffer = new PromiseBuffer(30); | ||
this._buffer = new PromiseBuffer(30); | ||
this.url = new API(this.options.dsn).getStoreEndpointWithUrlEncodedAuth(); | ||
@@ -14,4 +17,6 @@ } | ||
*/ | ||
async sendEvent(_) { | ||
throw new SentryError('Transport Class has to implement `sendEvent` method'); | ||
sendEvent(_) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
throw new SentryError('Transport Class has to implement `sendEvent` method'); | ||
}); | ||
} | ||
@@ -21,6 +26,8 @@ /** | ||
*/ | ||
async close(timeout) { | ||
return this.buffer.drain(timeout); | ||
close(timeout) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this._buffer.drain(timeout); | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=base.js.map |
@@ -1,2 +0,2 @@ | ||
import { SentryResponse } from '@sentry/types/esm'; | ||
import { Event, Response } from '@sentry/types'; | ||
import { BaseTransport } from './base'; | ||
@@ -8,3 +8,3 @@ /** `sendBeacon` based transport */ | ||
*/ | ||
sendEvent(body: string): Promise<SentryResponse>; | ||
sendEvent(event: Event): Promise<Response>; | ||
} |
@@ -1,3 +0,4 @@ | ||
import { Status } from '@sentry/types/esm'; | ||
import { getGlobalObject } from '@sentry/utils/esm/misc'; | ||
import * as tslib_1 from "tslib"; | ||
import { Status } from '@sentry/types'; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
import { BaseTransport } from './base'; | ||
@@ -10,9 +11,11 @@ const global = getGlobalObject(); | ||
*/ | ||
async sendEvent(body) { | ||
const result = global.navigator.sendBeacon(this.url, body); | ||
return this.buffer.add(Promise.resolve({ | ||
status: result ? Status.Success : Status.Failed, | ||
})); | ||
sendEvent(event) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const result = global.navigator.sendBeacon(this.url, JSON.stringify(event)); | ||
return this._buffer.add(Promise.resolve({ | ||
status: result ? Status.Success : Status.Failed, | ||
})); | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=beacon.js.map |
@@ -1,2 +0,2 @@ | ||
import { SentryResponse } from '@sentry/types/esm'; | ||
import { Event, Response } from '@sentry/types'; | ||
import { BaseTransport } from './base'; | ||
@@ -8,3 +8,3 @@ /** `fetch` based transport */ | ||
*/ | ||
sendEvent(body: string): Promise<SentryResponse>; | ||
sendEvent(event: Event): Promise<Response>; | ||
} |
@@ -1,4 +0,5 @@ | ||
import { Status } from '@sentry/types/esm'; | ||
import { getGlobalObject } from '@sentry/utils/esm/misc'; | ||
import { supportsReferrerPolicy } from '@sentry/utils/esm/supports'; | ||
import * as tslib_1 from "tslib"; | ||
import { Status } from '@sentry/types'; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
import { supportsReferrerPolicy } from '@sentry/utils/supports'; | ||
import { BaseTransport } from './base'; | ||
@@ -11,17 +12,19 @@ const global = getGlobalObject(); | ||
*/ | ||
async sendEvent(body) { | ||
const defaultOptions = { | ||
body, | ||
method: 'POST', | ||
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default | ||
// https://caniuse.com/#feat=referrer-policy | ||
// It doesn't. And it throw exception instead of ignoring this parameter... | ||
// REF: https://github.com/getsentry/raven-js/issues/1233 | ||
referrerPolicy: (supportsReferrerPolicy() ? 'origin' : ''), | ||
}; | ||
return this.buffer.add(global.fetch(this.url, defaultOptions).then(response => ({ | ||
status: Status.fromHttpCode(response.status), | ||
}))); | ||
sendEvent(event) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const defaultOptions = { | ||
body: JSON.stringify(event), | ||
method: 'POST', | ||
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default | ||
// https://caniuse.com/#feat=referrer-policy | ||
// It doesn't. And it throw exception instead of ignoring this parameter... | ||
// REF: https://github.com/getsentry/raven-js/issues/1233 | ||
referrerPolicy: (supportsReferrerPolicy() ? 'origin' : ''), | ||
}; | ||
return this._buffer.add(global.fetch(this.url, defaultOptions).then(response => ({ | ||
status: Status.fromHttpCode(response.status), | ||
}))); | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=fetch.js.map |
@@ -1,2 +0,2 @@ | ||
import { SentryResponse } from '@sentry/types/esm'; | ||
import { Event, Response } from '@sentry/types'; | ||
import { BaseTransport } from './base'; | ||
@@ -8,3 +8,3 @@ /** `XHR` based transport */ | ||
*/ | ||
sendEvent(body: string): Promise<SentryResponse>; | ||
sendEvent(event: Event): Promise<Response>; | ||
} |
@@ -1,2 +0,3 @@ | ||
import { Status } from '@sentry/types/esm'; | ||
import * as tslib_1 from "tslib"; | ||
import { Status } from '@sentry/types'; | ||
import { BaseTransport } from './base'; | ||
@@ -8,21 +9,23 @@ /** `XHR` based transport */ | ||
*/ | ||
async sendEvent(body) { | ||
return this.buffer.add(new Promise((resolve, reject) => { | ||
const request = new XMLHttpRequest(); | ||
request.onreadystatechange = () => { | ||
if (request.readyState !== 4) { | ||
return; | ||
} | ||
if (request.status === 200) { | ||
resolve({ | ||
status: Status.fromHttpCode(request.status), | ||
}); | ||
} | ||
reject(request); | ||
}; | ||
request.open('POST', this.url); | ||
request.send(body); | ||
})); | ||
sendEvent(event) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this._buffer.add(new Promise((resolve, reject) => { | ||
const request = new XMLHttpRequest(); | ||
request.onreadystatechange = () => { | ||
if (request.readyState !== 4) { | ||
return; | ||
} | ||
if (request.status === 200) { | ||
resolve({ | ||
status: Status.fromHttpCode(request.status), | ||
}); | ||
} | ||
reject(request); | ||
}; | ||
request.open('POST', this.url); | ||
request.send(JSON.stringify(event)); | ||
})); | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=xhr.js.map |
export declare const SDK_NAME = "sentry.javascript.browser"; | ||
export declare const SDK_VERSION = "4.6.4"; | ||
export declare const SDK_VERSION = "5.0.0-rc.0"; |
export const SDK_NAME = 'sentry.javascript.browser'; | ||
export const SDK_VERSION = '4.6.4'; | ||
export const SDK_VERSION = '5.0.0-rc.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@sentry/browser", | ||
"version": "4.6.4", | ||
"version": "5.0.0-rc.0", | ||
"description": "Offical Sentry SDK for browsers", | ||
@@ -13,2 +13,4 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"main": "dist/index.js", | ||
"module": "esm/index.js", | ||
"browser": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
@@ -19,12 +21,13 @@ "publishConfig": { | ||
"dependencies": { | ||
"@sentry/core": "4.6.4", | ||
"@sentry/types": "4.5.3", | ||
"@sentry/utils": "4.6.4", | ||
"@sentry/core": "5.0.0-rc.0", | ||
"@sentry/types": "5.0.0-rc.0", | ||
"@sentry/utils": "5.0.0-rc.0", | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
"@types/md5": "2.1.32", | ||
"@types/md5": "2.1.33", | ||
"chai": "^4.1.2", | ||
"jsdom": "^11.12.0", | ||
"karma": "^2.0.2", | ||
"jest": "^24.5.0", | ||
"jsdom": "^14.0.0", | ||
"karma": "^4.0.1", | ||
"karma-chai": "^0.1.0", | ||
@@ -36,30 +39,29 @@ "karma-chrome-launcher": "^2.2.0", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"karma-rollup-preprocessor": "^6.0.0", | ||
"karma-sauce-launcher": "^1.2.0", | ||
"karma-typescript": "^3.0.12", | ||
"karma-typescript-es6-transform": "^1.0.4", | ||
"karma-rollup-preprocessor": "^7.0.0", | ||
"karma-sauce-launcher": "^2.0.2", | ||
"karma-sinon": "^1.0.5", | ||
"karma-typescript": "^4.0.0", | ||
"karma-typescript-es6-transform": "^4.0.0", | ||
"npm-run-all": "^4.1.2", | ||
"prettier": "^1.14.0", | ||
"prettier": "^1.16.4", | ||
"prettier-check": "^2.0.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.58.2", | ||
"rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-license": "^0.6.0", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
"rollup-plugin-npm": "^2.0.0", | ||
"rollup-plugin-typescript2": "^0.13.0", | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"sinon": "^5.0.3", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.2.0", | ||
"webpack": "^4.26.0" | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.6.0", | ||
"rollup-plugin-commonjs": "^9.2.1", | ||
"rollup-plugin-license": "^0.8.1", | ||
"rollup-plugin-node-resolve": "^4.0.1", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"rollup-plugin-typescript2": "^0.20.1", | ||
"sinon": "^7.2.7", | ||
"tslint": "^5.14.0", | ||
"typescript": "^3.3.3333", | ||
"webpack": "^4.29.6" | ||
}, | ||
"scripts": { | ||
"build": "run-p build:esm build:es5", | ||
"build:es5": "rollup --config", | ||
"build:esm": "run-s build:esm:transpile build:esm:rewrite", | ||
"build:esm:transpile": "tsc -p tsconfig.esm.json", | ||
"build:esm:rewrite": "node ../../scripts/esm-rewrite.js", | ||
"build": "run-s build:esm build:bundle", | ||
"build:bundle": "rollup --config", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
"build:watch": "rollup --config --watch", | ||
"clean": "rimraf dist coverage .rpt2_cache build", | ||
"clean": "rimraf dist coverage .rpt2_cache build esm", | ||
"link:yarn": "yarn link", | ||
"lint": "run-s lint:prettier lint:tslint", | ||
@@ -78,3 +80,5 @@ "lint:prettier": "prettier-check \"{src,test}/**/*.ts\"", | ||
"test:manual": "node test/manual/npm-build.js && rm test/manual/tmp.js", | ||
"size:check": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print $1,\"kB\";}'", | ||
"size:check": "run-p size:check:es5 size:check:es6", | ||
"size:check:es5": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES5: \",$1,\"kB\";}'", | ||
"size:check:es6": "cat build/bundle.es6.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES6: \",$1,\"kB\";}'", | ||
"version": "node ../../scripts/versionbump.js src/version.ts" | ||
@@ -81,0 +85,0 @@ }, |
@@ -16,4 +16,2 @@ <p align="center"> | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/sentryio.svg)](https://saucelabs.com/u/sentryio) | ||
## Links | ||
@@ -26,4 +24,4 @@ | ||
To use this SDK, call `Sentry.init(options)` as early as possible after loading the page. This will initialize the SDK and hook | ||
into the environment. Note that you can turn off almost all side effects using the respective options. | ||
To use this SDK, call `Sentry.init(options)` as early as possible after loading the page. This will initialize the SDK | ||
and hook into the environment. Note that you can turn off almost all side effects using the respective options. | ||
@@ -30,0 +28,0 @@ ```javascript |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
2272509
18213
30
70
1
65
3
+ Added@sentry/core@5.0.0-rc.0(transitive)
+ Added@sentry/hub@5.0.0-rc.0(transitive)
+ Added@sentry/minimal@5.0.0-rc.0(transitive)
+ Added@sentry/types@5.0.0-rc.0(transitive)
+ Added@sentry/utils@5.0.0-rc.0(transitive)
- Removed@sentry/core@4.6.4(transitive)
- Removed@sentry/hub@4.6.4(transitive)
- Removed@sentry/minimal@4.6.4(transitive)
- Removed@sentry/types@4.5.3(transitive)
- Removed@sentry/utils@4.6.4(transitive)
Updated@sentry/core@5.0.0-rc.0
Updated@sentry/types@5.0.0-rc.0
Updated@sentry/utils@5.0.0-rc.0