Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getsentry/sentry-javascript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.6.1
Choose a base ref
...
head repository: getsentry/sentry-javascript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.6.2
Choose a head ref
  • 6 commits
  • 15 files changed
  • 2 contributors

Commits on Feb 14, 2019

  1. Copy the full SHA
    da7a115 View commit details

Commits on Feb 19, 2019

  1. fix: use a static object as fallback of the global object (#1901)

    * fix: use a static object as fallback of the global object
    
    * test: add test for getGlobalObject
    Means88 authored and kamilogorek committed Feb 19, 2019
    Copy the full SHA
    bd35d73 View commit details
  2. Copy the full SHA
    2ec2955 View commit details
  3. Copy the full SHA
    ddfd251 View commit details
  4. misc: 4.6.2 changelog

    kamilogorek committed Feb 19, 2019
    Copy the full SHA
    6d9b3e5 View commit details
  5. release: 4.6.2

    kamilogorek committed Feb 19, 2019
    Copy the full SHA
    1c1b071 View commit details
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,12 @@

## Unreleased

## 4.6.2

- [utils] fix: Preserve function prototype when filling
- [utils] fix: use a static object as fallback of the global object
- [node] feat: Read from `SENTRY_RELEASE` and `SENTRY_ENVIRONMENT` if present

## 4.6.1

- [utils] fix: Patch `tslib_1__default` regression and add additional tests around it
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.4.0",
"version": "4.6.1",
"version": "4.6.2",
"packages": "packages/*",
"ignore": "raven-*",
"npmClient": "yarn",
6 changes: 3 additions & 3 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/browser",
"version": "4.6.1",
"version": "4.6.2",
"description": "Offical Sentry SDK for browsers",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
@@ -15,9 +15,9 @@
"access": "public"
},
"dependencies": {
"@sentry/core": "4.6.1",
"@sentry/core": "4.6.2",
"@sentry/types": "4.5.3",
"@sentry/utils": "4.6.1",
"@sentry/utils": "4.6.2",
"tslib": "^1.9.3"
},
"devDependencies": {
2 changes: 1 addition & 1 deletion packages/browser/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const SDK_NAME = 'sentry.javascript.browser';
export const SDK_VERSION = '4.6.1';
export const SDK_VERSION = '4.6.2';
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/core",
"version": "4.6.1",
"version": "4.6.2",
"description": "Base implementation for all Sentry JavaScript SDKs",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core",
@@ -15,10 +15,10 @@
"access": "public"
},
"dependencies": {
"@sentry/hub": "4.6.1",
"@sentry/minimal": "4.6.1",
"@sentry/hub": "4.6.2",
"@sentry/minimal": "4.6.2",
"@sentry/types": "4.5.3",
"@sentry/utils": "4.6.1",
"@sentry/utils": "4.6.2",
"tslib": "^1.9.3"
},
"devDependencies": {
4 changes: 2 additions & 2 deletions packages/hub/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/hub",
"version": "4.6.1",
"version": "4.6.2",
"description": "Sentry hub which handles global state managment.",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/hub",
@@ -16,7 +16,7 @@
},
"dependencies": {
"@sentry/types": "4.5.3",
"@sentry/utils": "4.6.1",
"@sentry/utils": "4.6.2",
"tslib": "^1.9.3"
},
"devDependencies": {
4 changes: 2 additions & 2 deletions packages/minimal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/minimal",
"version": "4.6.1",
"version": "4.6.2",
"description": "Sentry minimal library that can be used in other packages",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/minimal",
@@ -15,7 +15,7 @@
"access": "public"
},
"dependencies": {
"@sentry/hub": "4.6.1",
"@sentry/hub": "4.6.2",
"@sentry/types": "4.5.3",
"tslib": "^1.9.3"
},
8 changes: 4 additions & 4 deletions packages/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/node",
"version": "4.6.1",
"version": "4.6.2",
"description": "Offical Sentry SDK for Node.js",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
@@ -15,10 +15,10 @@
"access": "public"
},
"dependencies": {
"@sentry/core": "4.6.1",
"@sentry/hub": "4.6.1",
"@sentry/core": "4.6.2",
"@sentry/hub": "4.6.2",
"@sentry/types": "4.5.3",
"@sentry/utils": "4.6.1",
"@sentry/utils": "4.6.2",
"@types/stack-trace": "0.0.29",
"cookie": "0.3.1",
"https-proxy-agent": "2.2.1",
8 changes: 8 additions & 0 deletions packages/node/src/sdk.ts
Original file line number Diff line number Diff line change
@@ -74,6 +74,14 @@ export function init(options: NodeOptions = {}): void {
options.dsn = process.env.SENTRY_DSN;
}

if (options.release === undefined && process.env.SENTRY_RELEASE) {
options.release = process.env.SENTRY_RELEASE;
}

if (options.environment === undefined && process.env.SENTRY_ENVIRONMENT) {
options.environment = process.env.SENTRY_ENVIRONMENT;
}

if (domain.active) {
setHubOnCarrier(getMainCarrier(), getCurrentHub());
}
2 changes: 1 addition & 1 deletion packages/node/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const SDK_NAME = 'sentry.javascript.node';
export const SDK_VERSION = '4.6.1';
export const SDK_VERSION = '4.6.2';
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/utils",
"version": "4.6.1",
"version": "4.6.2",
"description": "Utilities for all Sentry JavaScript SDKs",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/utils",
10 changes: 9 additions & 1 deletion packages/utils/src/misc.ts
Original file line number Diff line number Diff line change
@@ -20,14 +20,22 @@ export function isNodeEnv(): boolean {
return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
}

const fallbackGlobalObject = {};

/**
* Safely get global scope object
*
* @returns Global scope object
*/
// tslint:disable:strict-type-predicates
export function getGlobalObject(): Window | NodeJS.Global | {} {
return isNodeEnv() ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {};
return isNodeEnv()
? global
: typeof window !== 'undefined'
? window
: typeof self !== 'undefined'
? self
: fallbackGlobalObject;
}
// tslint:enable:strict-type-predicates

2 changes: 1 addition & 1 deletion packages/utils/src/object.ts
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ export function fill(source: { [key: string]: any }, name: string, replacement:
// otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
// tslint:disable-next-line:strict-type-predicates
if (typeof wrapped === 'function') {
wrapped.prototype = {};
wrapped.prototype = wrapped.prototype || {};
Object.defineProperties(wrapped, {
__sentry__: {
enumerable: false,
13 changes: 12 additions & 1 deletion packages/utils/test/misc.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getEventDescription } from '../src/misc';
import { getEventDescription, getGlobalObject } from '../src/misc';

describe('getEventDescription()', () => {
test('message event', () => {
@@ -108,3 +108,14 @@ describe('getEventDescription()', () => {
).toEqual('<unknown>');
});
});

describe('getGlobalObject()', () => {
test('should return the same object', () => {
const backup = global.process;
delete global.process;
const first = getGlobalObject();
const second = getGlobalObject();
expect(first).toEqual(second);
global.process = backup;
});
});
15 changes: 15 additions & 0 deletions packages/utils/test/object.test.ts
Original file line number Diff line number Diff line change
@@ -340,6 +340,21 @@ describe('fill()', () => {
expect(source.foo.__sentry_original__).toBe(source.foo);
expect(source.foo.__sentry_wrapped__).toBe(source.foo);
});

test('should preserve functions prototype if one exists', () => {
const source = {
foo: (): number => 42,
};
const bar = {};
source.foo.prototype = bar;
const name = 'foo';
const replacement = cb => cb;

fill(source, name, replacement);

// But should be accessible directly
expect(source.foo.prototype).toBe(bar);
});
});

describe('urlEncode()', () => {