🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@sentry/browser

Package Overview
Dependencies
Maintainers
9
Versions
627
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/browser - npm Package Compare versions

Comparing version

to
0.5.0-beta.2

dist/backend.d.ts

8

dist/index.d.ts

@@ -1,3 +0,5 @@

export { BrowserBackend, BrowserOptions } from './lib/backend';
export { BrowserFrontend } from './lib/frontend';
export { addBreadcrumb, create, captureEvent, captureException, captureMessage, clearScope, popScope, pushScope, setUserContext, setExtraContext, setTagsContext } from './lib/sdk';
export { Breadcrumb, Context, Request, SdkInfo, SentryEvent, SentryException, Severity, StackFrame, Stacktrace, Thread, User } from '@sentry/shim';
export { addBreadcrumb, captureMessage, captureException, captureEvent, clearScope, popScope, pushScope, setUserContext, setTagsContext, setExtraContext, withScope } from '@sentry/shim';
export { BrowserBackend, BrowserOptions } from './backend';
export { BrowserFrontend } from './frontend';
export { create, getCurrentFrontend } from './sdk';

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

Raven.setBreadcrumbCallback(function (breadcrumb) {
core.addBreadcrumb(breadcrumb);
shim.addBreadcrumb(breadcrumb);
return false;

@@ -134,3 +134,3 @@ });

Raven._sendProcessedPayload = function (event) {
core.captureEvent(normalizeRavenEvent(event));
shim.captureEvent(normalizeRavenEvent(event));
};

@@ -198,2 +198,14 @@ return true;

};
/**
* @inheritDoc
*/
BrowserBackend.prototype.storeBreadcrumb = function () {
return true;
};
/**
* @inheritDoc
*/
BrowserBackend.prototype.storeContext = function () {
return true;
};
return BrowserBackend;

@@ -243,10 +255,10 @@ }());

*
* To use this SDK, call the {@link Sdk.create} function as early as possible
* when loading the web page. To set context information or send manual events,
* use the provided methods.
* To use this SDK, call the {@link create} function as early as possible when
* loading the web page. To set context information or send manual events, use
* the provided methods.
*
* @example
* const { SentryClient } = require('@sentry/browser');
* import { create } from '@sentry/browser';
*
* SentryClient.create({
* create({
* dsn: '__DSN__',

@@ -257,3 +269,4 @@ * // ...

* @example
* SentryClient.setContext({
* import { setContext } from '@sentry/browser';
* setContext({
* extra: { battery: 0.7 },

@@ -265,3 +278,4 @@ * tags: { user_mode: 'admin' },

* @example
* SentryClient.addBreadcrumb({
* import { addBreadcrumb } from '@sentry/browser';
* addBreadcrumb({
* message: 'My Breadcrumb',

@@ -272,5 +286,6 @@ * // ...

* @example
* SentryClient.captureMessage('Hello, world!');
* SentryClient.captureException(new Error('Good bye'));
* SentryClient.captureEvent({
* import * as Sentry from '@sentry/browser';
* Sentry.captureMessage('Hello, world!');
* Sentry.captureException(new Error('Good bye'));
* Sentry.captureEvent({
* message: 'Manual',

@@ -281,3 +296,3 @@ * stacktrace: [

* });
* TODO
*
* @see BrowserOptions for documentation on configuration options.

@@ -288,15 +303,22 @@ */

}
/** Returns the current BrowserFrontend, if any. */
function getCurrentFrontend() {
return shim.getCurrentClient();
}
exports.addBreadcrumb = core.addBreadcrumb;
exports.captureEvent = core.captureEvent;
exports.setUserContext = core.setUserContext;
exports.Severity = shim.Severity;
exports.addBreadcrumb = shim.addBreadcrumb;
exports.captureMessage = shim.captureMessage;
exports.captureException = shim.captureException;
exports.captureMessage = shim.captureMessage;
exports.captureEvent = shim.captureEvent;
exports.clearScope = shim.clearScope;
exports.popScope = shim.popScope;
exports.pushScope = shim.pushScope;
exports.setUserContext = shim.setUserContext;
exports.setTagsContext = shim.setTagsContext;
exports.setExtraContext = shim.setExtraContext;
exports.setTagsContext = shim.setTagsContext;
exports.withScope = shim.withScope;
exports.BrowserBackend = BrowserBackend;
exports.BrowserFrontend = BrowserFrontend;
exports.create = create;
exports.getCurrentFrontend = getCurrentFrontend;
{
"name": "@sentry/browser",
"version": "0.5.0-beta.1",
"version": "0.5.0-beta.2",
"description": "Offical Sentry SDK for browsers",
"repository": "https://github.com/getsentry/raven-js",
"repository": "https://github.com/getsentry/raven-js/tree/next",
"author": "Sentry",

@@ -17,4 +17,4 @@ "license": "BSD-3-Clause",

"dependencies": {
"@sentry/core": "0.5.0-beta.1",
"@sentry/shim": "0.5.0-beta.1",
"@sentry/core": "0.5.0-beta.2",
"@sentry/shim": "0.5.0-beta.2",
"raven-js": "^3.23.3"

@@ -25,2 +25,8 @@ },

"karma": "^2.0.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-rollup-preprocessor": "^5.1.1",
"karma-typescript": "^3.0.12",
"npm-run-all": "^4.1.2",

@@ -31,3 +37,8 @@ "prettier": "^1.11.1",

"rollup": "^0.56.4",
"rollup-plugin-commonjs": "^9.0.0",
"rollup-plugin-node-resolve": "^3.0.3",
"rollup-plugin-npm": "^2.0.0",
"rollup-plugin-shim": "^1.0.0",
"rollup-plugin-typescript2": "^0.12.0",
"rollup-plugin-uglify": "^3.0.0",
"sinon": "^4.4.3",

@@ -34,0 +45,0 @@ "tslint": "^5.9.1",

@@ -8,3 +8,3 @@ <p align="center">

# Official Sentry SDK for Browsers (JavaScript)
# Official Sentry SDK for Browsers (Preview)

@@ -15,12 +15,18 @@ [![npm version](https://img.shields.io/npm/v/@sentry/browser.svg)](https://www.npmjs.com/package/@sentry/browser)

**WARNING:** This SDK is part of an early access preview for the
[next generation](https://github.com/getsentry/raven-js/tree/next#readme) of
Sentry JavaScript SDKs. Public interfaces might change and break backwards
compatibility from time to time. We absolutely recommend
[raven-js](https://github.com/getsentry/raven-js) in production!
## Usage
To use this SDK, call `SentryClient.create(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 `create(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.
```javascript
import { SentryClient } from '@sentry/browser';
import { create } from '@sentry/browser';
SentryClient.create({
create({
dsn: '__DSN__',

@@ -31,16 +37,16 @@ // ...

To set context information or send manual events, use the provided methods on
`SentryClient`. Note that these functions will not perform any action before you
have called `SentryClient.create()`:
To set context information or send manual events, use the exported functions of
`@sentry/browser`. Note that these functions will not perform any action before
you have called `create()`:
```javascript
import * as Sentry from '@sentry/browser';
// Set user information, as well as tags and further extras
SentryClient.setContext({
extra: { battery: 0.7 },
tags: { user_mode: 'admin' },
user: { id: '4711' },
});
Sentry.setExtraContext({ battery: 0.7 });
Sentry.setTagsContext({ user_mode: 'admin' });
Sentry.setUserContext({ id: '4711' });
// Add a breadcrumb for future events
SentryClient.addBreadcrumb({
Sentry.addBreadcrumb({
message: 'My Breadcrumb',

@@ -51,5 +57,5 @@ // ...

// Capture exceptions, messages or manual events
SentryClient.captureMessage('Hello, world!');
SentryClient.captureException(new Error('Good bye'));
SentryClient.captureEvent({
Sentry.captureMessage('Hello, world!');
Sentry.captureException(new Error('Good bye'));
Sentry.captureEvent({
message: 'Manual',

@@ -78,23 +84,1 @@ stacktrace: [

```
Note that `install()` returns a `Promise` that resolves when the installation
has finished. It is not necessary to wait for the installation before adding
breadcrumbs, defining context or sending events. However, the return value
indicates whether the installation was successful and the environment could be
instrumented:
```javascript
import { BrowserFrontend } from '@sentry/browser';
const client = new BrowserFrontend({
dsn: '__DSN__',
// ...
});
const success = await client.install();
if (success) {
// Will catch global exceptions, record breadcrumbs for DOM events, etc...
} else {
// Limited instrumentation, but sending events will still work
}
```