Skip to content

Commit de9b90d

Browse files
committed
[v7] Use new transports in all packages
1 parent 7eb6e08 commit de9b90d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+456
-2527
lines changed

.eslintrc.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ module.exports = {
88
ecmaVersion: 2018,
99
},
1010
extends: ['prettier', 'eslint:recommended', 'plugin:import/errors', 'plugin:import/warnings'],
11-
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'cjs/**', 'examples/**', 'scripts/**', 'test/manual/**'],
11+
ignorePatterns: [
12+
'coverage/**',
13+
'build/**',
14+
'dist/**',
15+
'esm/**',
16+
'cjs/**',
17+
'examples/**',
18+
'scripts/**',
19+
'test/manual/**',
20+
],
1221
rules: {
1322
// We want to prevent usage of unary operators outside of for loops
1423
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "7.0.0-alpha",
2+
"version": "7.0.0-alpha.0",
33
"useWorkspaces": true,
44
"npmClient": "yarn"
55
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-javascript",
3-
"version": "7.0.0-alpha",
3+
"version": "7.0.0-alpha.0",
44
"description": "Official Sentry JavaScript SDK",
55
"repository": "https://github.com/getsentry/sentry-javascript",
66
"author": "Sentry",

packages/angular/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
},
2323
"dependencies": {
2424
"@sentry/browser": "6.2.3",
25+
"@sentry/transport-base": "7.0.0-alpha.0",
2526
"@sentry/types": "6.2.3",
2627
"@sentry/utils": "6.2.3",
2728
"rxjs": "^6.6.0"

packages/angular/src/errorhandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { HttpErrorResponse } from '@angular/common/http';
22
import { ErrorHandler as AngularErrorHandler, Injectable } from '@angular/core';
33
import * as Sentry from '@sentry/browser';
4+
import { ReportDialogOptions } from '@sentry/transport-base';
45

56
/**
67
* Options used to configure the behavior of the Angular ErrorHandler.
78
*/
89
export interface ErrorHandlerOptions {
910
logErrors?: boolean;
1011
showDialog?: boolean;
11-
dialogOptions?: Sentry.ReportDialogOptions;
12+
dialogOptions?: ReportDialogOptions;
1213
/**
1314
* Custom implementation of error extraction from the raw value captured by the Angular.
1415
* @param error Value captured by Angular's ErrorHandler provider

packages/browser/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
},
1818
"dependencies": {
1919
"@sentry/core": "6.2.3",
20+
"@sentry/transport-base": "7.0.0-alpha.0",
21+
"@sentry/transport-fetch": "7.0.0-alpha.0",
22+
"@sentry/transport-xhr": "7.0.0-alpha.0",
2023
"@sentry/types": "6.2.3",
2124
"@sentry/utils": "6.2.3"
2225
},

packages/browser/src/backend.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { BaseBackend } from '@sentry/core';
2-
import { Event, EventHint, Options, Severity, Transport } from '@sentry/types';
2+
import { Event, EventHint, Options, Severity } from '@sentry/types';
33
import { supportsFetch } from '@sentry/utils';
4+
import { NoopTransport, Transport, TransportOptions } from '@sentry/transport-base';
5+
import { FetchTransport } from '@sentry/transport-fetch';
6+
import { XHRTransport } from '@sentry/transport-xhr';
47

58
import { eventFromException, eventFromMessage } from './eventbuilder';
6-
import { FetchTransport, XHRTransport } from './transports';
79

810
/**
911
* Configuration options for the Sentry Browser SDK.
@@ -55,24 +57,22 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
5557
return eventFromMessage(this._options, message, level, hint);
5658
}
5759

58-
/**
59-
* @inheritDoc
60-
*/
6160
protected _setupTransport(): Transport {
61+
// TODO: This whole function should be unnecessary and moved to client construction
6262
if (!this._options.dsn) {
6363
// We return the noop transport here in case there is no Dsn.
64-
return super._setupTransport();
64+
return new NoopTransport();
6565
}
6666

67-
const transportOptions = {
67+
const transportOptions: TransportOptions = {
6868
...this._options.transportOptions,
69-
dsn: this._options.dsn,
70-
_metadata: this._options._metadata,
69+
dsn: this._options.transportOptions?.dsn ?? this._options.dsn,
7170
};
7271

7372
if (this._options.transport) {
7473
return new this._options.transport(transportOptions);
7574
}
75+
7676
if (supportsFetch()) {
7777
return new FetchTransport(transportOptions);
7878
}

packages/browser/src/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { BaseClient, ReportDialogOptions, Scope, SDK_VERSION } from '@sentry/core';
1+
import { BaseClient, Scope, SDK_VERSION } from '@sentry/core';
22
import { Event, EventHint } from '@sentry/types';
33
import { getGlobalObject, logger } from '@sentry/utils';
4+
import { ReportDialogOptions } from '@sentry/transport-base';
45

56
import { BrowserBackend, BrowserOptions } from './backend';
67
import { injectReportDialog } from './helpers';

packages/browser/src/exports.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ export {
2424
configureScope,
2525
getHubFromCarrier,
2626
getCurrentHub,
27-
getReportDialogEndpoint,
2827
Hub,
2928
makeMain,
30-
ReportDialogOptions,
3129
Scope,
3230
startTransaction,
3331
SDK_VERSION,

packages/browser/src/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { captureException, Dsn, getReportDialogEndpoint, ReportDialogOptions, withScope } from '@sentry/core';
1+
import { captureException, withScope } from '@sentry/core';
22
import { Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';
33
import { addExceptionMechanism, addExceptionTypeValue, logger } from '@sentry/utils';
4+
import { Dsn, getReportDialogEndpoint, ReportDialogOptions } from '@sentry/transport-base';
45

56
let ignoreOnError: number = 0;
67

packages/browser/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Integrations as CoreIntegrations } from '@sentry/core';
44
import { getGlobalObject } from '@sentry/utils';
55

66
import * as BrowserIntegrations from './integrations';
7-
import * as Transports from './transports';
87

98
let windowIntegrations = {};
109

@@ -20,4 +19,4 @@ const INTEGRATIONS = {
2019
...BrowserIntegrations,
2120
};
2221

23-
export { INTEGRATIONS as Integrations, Transports };
22+
export { INTEGRATIONS as Integrations };

packages/browser/src/sdk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { getCurrentHub, initAndBind, Integrations as CoreIntegrations, ReportDialogOptions } from '@sentry/core';
1+
import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@sentry/core';
22
import { addInstrumentationHandler, getGlobalObject, logger, SyncPromise } from '@sentry/utils';
3+
import { ReportDialogOptions } from '@sentry/transport-base';
34

45
import { BrowserOptions } from './backend';
56
import { BrowserClient } from './client';

packages/browser/src/transports/base.ts

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)