Skip to content

Commit 108688c

Browse files
committed
ref: Make setupOnce optional in integrations
1 parent 4f92ff0 commit 108688c

35 files changed

+3
-42
lines changed

packages/browser/src/integrations/breadcrumbs.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const _breadcrumbsIntegration = ((options: Partial<BreadcrumbsOptions> = {}) =>
7171
return {
7272
name: INTEGRATION_NAME,
7373
// TODO v8: Remove this
74-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
7574
setup(client) {
7675
if (_options.console) {
7776
addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client));

packages/browser/src/integrations/dedupe.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const _dedupeIntegration = (() => {
1212
return {
1313
name: INTEGRATION_NAME,
1414
// TODO v8: Remove this
15-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1615
processEvent(currentEvent) {
1716
// We want to ignore any non-error type events, e.g. transactions or replays
1817
// These should never be deduped, and also not be compared against as _previousEvent.

packages/browser/src/integrations/httpcontext.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const _httpContextIntegration = (() => {
99
return {
1010
name: INTEGRATION_NAME,
1111
// TODO v8: Remove this
12-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1312
preprocessEvent(event) {
1413
// if none of the information we want exists, don't bother
1514
if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {

packages/browser/src/integrations/linkederrors.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {
2020
return {
2121
name: INTEGRATION_NAME,
2222
// TODO v8: Remove this
23-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2423
preprocessEvent(event, hint, client) {
2524
const options = client.getOptions();
2625

packages/browser/src/profiling/integration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const _browserProfilingIntegration = (() => {
2222
return {
2323
name: INTEGRATION_NAME,
2424
// TODO v8: Remove this
25-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2625
setup(client) {
2726
const scope = getCurrentScope();
2827

packages/core/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function setupIntegration(client: Client, integration: Integration, integ
129129
integrationIndex[integration.name] = integration;
130130

131131
// `setupOnce` is only called the first time
132-
if (installedIntegrations.indexOf(integration.name) === -1) {
132+
if (installedIntegrations.indexOf(integration.name) === -1 && typeof integration.setupOnce === 'function') {
133133
// eslint-disable-next-line deprecation/deprecation
134134
integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
135135
installedIntegrations.push(integration.name);

packages/core/src/integrations/inboundfilters.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const _inboundFiltersIntegration = ((options: Partial<InboundFiltersOptions> = {
3434
return {
3535
name: INTEGRATION_NAME,
3636
// TODO v8: Remove this
37-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
3837
processEvent(event, _hint, client) {
3938
const clientOptions = client.getOptions();
4039
const mergedOptions = _mergeOptions(options, clientOptions);

packages/core/src/integrations/linkederrors.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {
1919
return {
2020
name: INTEGRATION_NAME,
2121
// TODO v8: Remove this
22-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2322
preprocessEvent(event, hint, client) {
2423
const options = client.getOptions();
2524

packages/core/src/integrations/metadata.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const _moduleMetadataIntegration = (() => {
1010
return {
1111
name: INTEGRATION_NAME,
1212
// TODO v8: Remove this
13-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1413
setup(client) {
1514
// We need to strip metadata from stack frames before sending them to Sentry since these are client side only.
1615
client.on('beforeEnvelope', envelope => {

packages/core/src/integrations/requestdata.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ const _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) =
7676
return {
7777
name: INTEGRATION_NAME,
7878
// TODO v8: Remove this
79-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
8079
processEvent(event, _hint, client) {
8180
// Note: In the long run, most of the logic here should probably move into the request data utility functions. For
8281
// the moment it lives here, though, until https://github.com/getsentry/sentry-javascript/issues/5718 is addressed.

packages/deno/src/integrations/context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const _denoContextIntegration = (() => {
5656
return {
5757
name: INTEGRATION_NAME,
5858
// TODO v8: Remove this
59-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
6059
processEvent(event) {
6160
return addDenoRuntimeContext(event);
6261
},

packages/deno/src/integrations/contextlines.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const _contextLinesIntegration = ((options: ContextLinesOptions = {}) => {
5353
return {
5454
name: INTEGRATION_NAME,
5555
// TODO v8: Remove this
56-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
5756
processEvent(event) {
5857
return addSourceContext(event, contextLines);
5958
},

packages/deno/src/integrations/globalhandlers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const _globalHandlersIntegration = ((options?: GlobalHandlersIntegrations) => {
3232
return {
3333
name: INTEGRATION_NAME,
3434
// TODO v8: Remove this
35-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
3635
setup(client) {
3736
if (_options.error) {
3837
installGlobalErrorHandler(client);

packages/deno/src/integrations/normalizepaths.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const _normalizePathsIntegration = (() => {
7171
return {
7272
name: INTEGRATION_NAME,
7373
// TODO v8: Remove this
74-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
7574
processEvent(event) {
7675
// This error.stack hopefully contains paths that traverse the app cwd
7776
const error = new Error();

packages/integrations/src/captureconsole.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const _captureConsoleIntegration = ((options: CaptureConsoleOptions = {}) => {
2121
return {
2222
name: INTEGRATION_NAME,
2323
// TODO v8: Remove this
24-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2524
setup(client) {
2625
if (!('console' in GLOBAL_OBJ)) {
2726
return;

packages/integrations/src/contextlines.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const _contextLinesIntegration = ((options: ContextLinesOptions = {}) => {
2424
return {
2525
name: INTEGRATION_NAME,
2626
// TODO v8: Remove this
27-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2827
processEvent(event) {
2928
return addSourceContext(event, contextLines);
3029
},

packages/integrations/src/debug.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const _debugIntegration = ((options: DebugOptions = {}) => {
2525
return {
2626
name: INTEGRATION_NAME,
2727
// TODO v8: Remove this
28-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2928
setup(client) {
3029
client.on('beforeSendEvent', (event: Event, hint?: EventHint) => {
3130
if (_options.debugger) {

packages/integrations/src/dedupe.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const _dedupeIntegration = (() => {
1212
return {
1313
name: INTEGRATION_NAME,
1414
// TODO v8: Remove this
15-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1615
processEvent(currentEvent) {
1716
// We want to ignore any non-error type events, e.g. transactions or replays
1817
// These should never be deduped, and also not be compared against as _previousEvent.

packages/integrations/src/extraerrordata.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const _extraErrorDataIntegration = ((options: Partial<ExtraErrorDataOptions> = {
2828
return {
2929
name: INTEGRATION_NAME,
3030
// TODO v8: Remove this
31-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
3231
processEvent(event, hint) {
3332
return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause);
3433
},

packages/integrations/src/httpclient.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const _httpClientIntegration = ((options: Partial<HttpClientOptions> = {}) => {
4848
return {
4949
name: INTEGRATION_NAME,
5050
// TODO v8: Remove this
51-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
5251
setup(client): void {
5352
_wrapFetch(client, _options);
5453
_wrapXHR(client, _options);

packages/integrations/src/rewriteframes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ const _rewriteFramesIntegration = ((options: RewriteFramesOptions = {}) => {
7272
return {
7373
name: INTEGRATION_NAME,
7474
// TODO v8: Remove this
75-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
7675
processEvent(originalEvent) {
7776
let processedEvent = originalEvent;
7877

packages/integrations/src/sessiontiming.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const _sessionTimingIntegration = (() => {
99
return {
1010
name: INTEGRATION_NAME,
1111
// TODO v8: Remove this
12-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1312
processEvent(event) {
1413
const now = Date.now();
1514

packages/node/src/integrations/anr/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const _anrIntegration = ((options: Partial<AnrIntegrationOptions> = {}) => {
5656
return {
5757
name: INTEGRATION_NAME,
5858
// TODO v8: Remove this
59-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
6059
setup(client: NodeClient) {
6160
if (NODE_VERSION.major < 16 || (NODE_VERSION.major === 16 && NODE_VERSION.minor < 17)) {
6261
throw new Error('ANR detection requires Node 16.17.0 or later');

packages/node/src/integrations/console.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const _consoleIntegration = (() => {
99
return {
1010
name: INTEGRATION_NAME,
1111
// TODO v8: Remove this
12-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1312
setup(client) {
1413
addConsoleInstrumentationHandler(({ args, level }) => {
1514
if (getClient() !== client) {

packages/node/src/integrations/context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ const _nodeContextIntegration = ((options: ContextOptions = {}) => {
103103
return {
104104
name: INTEGRATION_NAME,
105105
// TODO v8: Remove this
106-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
107106
processEvent(event) {
108107
return addContext(event);
109108
},

packages/node/src/integrations/contextlines.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const _contextLinesIntegration = ((options: ContextLinesOptions = {}) => {
4141
return {
4242
name: INTEGRATION_NAME,
4343
// TODO v8: Remove this
44-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
4544
processEvent(event) {
4645
return addSourceContext(event, contextLines);
4746
},

packages/node/src/integrations/local-variables/local-variables-async.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ const _localVariablesAsyncIntegration = ((options: LocalVariablesIntegrationOpti
221221
return {
222222
name: INTEGRATION_NAME,
223223
// TODO v8: Remove this
224-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
225224
setup(client: NodeClient) {
226225
const clientOptions = client.getOptions();
227226

packages/node/src/integrations/modules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ const _modulesIntegration = (() => {
8080
return {
8181
name: INTEGRATION_NAME,
8282
// TODO v8: Remove this
83-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
8483
processEvent(event) {
8584
event.modules = {
8685
...event.modules,

packages/node/src/integrations/onuncaughtexception.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const _onUncaughtExceptionIntegration = ((options: Partial<OnUncaughtExceptionOp
4949
return {
5050
name: INTEGRATION_NAME,
5151
// TODO v8: Remove this
52-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
5352
setup(client: NodeClient) {
5453
global.process.on('uncaughtException', makeErrorHandler(client, _options));
5554
},

packages/node/src/integrations/onunhandledrejection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const _onUnhandledRejectionIntegration = ((options: Partial<OnUnhandledRejection
2222
return {
2323
name: INTEGRATION_NAME,
2424
// TODO v8: Remove this
25-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2625
setup(client) {
2726
global.process.on('unhandledRejection', makeUnhandledPromiseHandler(client, { mode }));
2827
},

packages/node/src/integrations/spotlight.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {
2222
return {
2323
name: INTEGRATION_NAME,
2424
// TODO v8: Remove this
25-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2625
setup(client) {
2726
if (typeof process === 'object' && process.env && process.env.NODE_ENV !== 'development') {
2827
logger.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?");

packages/replay-canvas/src/canvas.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ export const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions>
6666

6767
return {
6868
name: INTEGRATION_NAME,
69-
// eslint-disable-next-line @typescript-eslint/no-empty-function
70-
setupOnce() {},
7169
getOptions(): ReplayCanvasIntegrationOptions {
7270
const { quality, enableManualSnapshot } = _canvasOptions;
7371

packages/types/src/integration.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ export interface IntegrationFnResult {
2424
/**
2525
* This hook is only called once, even if multiple clients are created.
2626
* It does not receives any arguments, and should only use for e.g. global monkey patching and similar things.
27-
*
28-
* NOTE: In v8, this will become optional.
2927
*/
30-
setupOnce(): void;
28+
setupOnce?(): void;
3129

3230
/**
3331
* Set up an integration for the given client.
@@ -74,10 +72,8 @@ export interface Integration {
7472
/**
7573
* This hook is only called once, even if multiple clients are created.
7674
* It does not receives any arguments, and should only use for e.g. global monkey patching and similar things.
77-
*
78-
* NOTE: In v8, this will become optional, and not receive any arguments anymore.
7975
*/
80-
setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
76+
setupOnce?(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
8177

8278
/**
8379
* Set up an integration for the given client.

packages/vercel-edge/src/integrations/wintercg-fetch.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ const _winterCGFetch = ((options: Partial<Options> = {}) => {
8787

8888
return {
8989
name: INTEGRATION_NAME,
90-
// TODO v8: Remove this again
91-
// eslint-disable-next-line @typescript-eslint/no-empty-function
9290
setupOnce() {
9391
addFetchInstrumentationHandler(handlerData => {
9492
const client = getClient();

packages/vue/src/integration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const _vueIntegration = ((integrationOptions: Partial<VueOptions> = {}) => {
2525
return {
2626
name: INTEGRATION_NAME,
2727
// TODO v8: Remove this
28-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2928
setup(client) {
3029
_setupIntegration(client, integrationOptions);
3130
},

0 commit comments

Comments
 (0)