Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d60fe7d

Browse files
committed
feat: Stop passing defaultIntegrations as client option
1 parent 8f5f2f3 commit d60fe7d

File tree

61 files changed

+538
-346
lines changed

Some content is hidden

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

61 files changed

+538
-346
lines changed

‎.size-limit.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ module.exports = [
3030
);
3131

3232
config.optimization.minimize = true;
33-
config.optimization.minimizer = [new TerserPlugin()];
33+
config.optimization.minimizer = [
34+
new TerserPlugin({
35+
terserOptions: {
36+
ecma: 'es2020',
37+
},
38+
}),
39+
];
3440

3541
return config;
3642
},
@@ -69,7 +75,13 @@ module.exports = [
6975
);
7076

7177
config.optimization.minimize = true;
72-
config.optimization.minimizer = [new TerserPlugin()];
78+
config.optimization.minimizer = [
79+
new TerserPlugin({
80+
terserOptions: {
81+
ecma: 'es2020',
82+
},
83+
}),
84+
];
7385

7486
return config;
7587
},
@@ -248,7 +260,13 @@ module.exports = [
248260
);
249261

250262
config.optimization.minimize = true;
251-
config.optimization.minimizer = [new TerserPlugin()];
263+
config.optimization.minimizer = [
264+
new TerserPlugin({
265+
terserOptions: {
266+
ecma: 'es2020',
267+
},
268+
}),
269+
];
252270

253271
return config;
254272
},

‎dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const NODE_EXPORTS_IGNORE = [
1818
'setNodeAsyncContextStrategy',
1919
'getDefaultIntegrationsWithoutPerformance',
2020
'initWithoutDefaultIntegrations',
21+
'initWithDefaultIntegrations',
2122
'SentryContextManager',
2223
'validateOpenTelemetrySetup',
2324
'preloadOpenTelemetry',

‎packages/angular/src/sdk.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
browserSessionIntegration,
66
globalHandlersIntegration,
77
httpContextIntegration,
8-
initasbrowserInit,
8+
initWithDefaultIntegrations,
99
linkedErrorsIntegration,
1010
setContext,
1111
} from '@sentry/browser';
@@ -50,14 +50,14 @@ export function getDefaultIntegrations(_options: BrowserOptions = {}): Integrati
5050
*/
5151
export function init(options: BrowserOptions): Client | undefined {
5252
const opts = {
53-
defaultIntegrations: getDefaultIntegrations(),
5453
...options,
5554
};
5655

5756
applySdkMetadata(opts, 'angular');
5857

5958
checkAndSetAngularVersion();
60-
return browserInit(opts);
59+
60+
return initWithDefaultIntegrations(opts, getDefaultIntegrations);
6161
}
6262

6363
function checkAndSetAngularVersion(): void {

‎packages/astro/src/client/sdk.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { BrowserOptions } from '@sentry/browser';
22
import {
33
browserTracingIntegration,
44
getDefaultIntegrations as getBrowserDefaultIntegrations,
5-
initasinitBrowserSdk,
5+
initWithDefaultIntegrations,
66
} from '@sentry/browser';
77
import type { Client, Integration } from '@sentry/core';
88
import { applySdkMetadata } from '@sentry/core';
@@ -17,13 +17,12 @@ declare const __SENTRY_TRACING__: boolean;
1717
*/
1818
export function init(options: BrowserOptions): Client | undefined {
1919
const opts = {
20-
defaultIntegrations: getDefaultIntegrations(options),
2120
...options,
2221
};
2322

2423
applySdkMetadata(opts, 'astro', ['astro', 'browser']);
2524

26-
return initBrowserSdk(opts);
25+
return initWithDefaultIntegrations(opts,getDefaultIntegrations);
2726
}
2827

2928
function getDefaultIntegrations(options: BrowserOptions): Integration[] {

‎packages/astro/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export * from '@sentry/node';
1515

1616
/** Initializes Sentry Astro SDK */
1717
export declare function init(options: Options | clientSdk.BrowserOptions | NodeOptions): Client | undefined;
18+
export declare function initWithDefaultIntegrations(
19+
options: Options | clientSdk.BrowserOptions | NodeOptions,
20+
getDefaultIntegrations: (options: Options) => Integration[],
21+
): Client | undefined;
1822

1923
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
2024
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;

‎packages/astro/test/client/sdk.test.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import type { BrowserClient } from '@sentry/browser';
21
import {
32
browserTracingIntegration,
43
getActiveSpan,
5-
getClient,
64
getCurrentScope,
75
getGlobalScope,
86
getIsolationScope,
@@ -12,7 +10,7 @@ import * as SentryBrowser from '@sentry/browser';
1210
import { afterEach, describe, expect, it, vi } from 'vitest';
1311
import { init } from '../../src/client/sdk';
1412

15-
const browserInit = vi.spyOn(SentryBrowser, 'init');
13+
const browserInit = vi.spyOn(SentryBrowser, 'initWithDefaultIntegrations');
1614

1715
describe('Sentry client SDK', () => {
1816
describe('init', () => {
@@ -44,6 +42,7 @@ describe('Sentry client SDK', () => {
4442
},
4543
},
4644
}),
45+
expect.any(Function),
4746
);
4847
});
4948

@@ -53,45 +52,39 @@ describe('Sentry client SDK', () => {
5352
['tracesSampler', { tracesSampler: () => 1.0 }],
5453
['no tracing option set', {}],
5554
])('adds browserTracingIntegration if tracing is enabled via %s', (_, tracingOptions) => {
56-
init({
55+
constclient=init({
5756
dsn: 'https://public@dsn.ingest.sentry.io/1337',
5857
...tracingOptions,
5958
});
6059

61-
const integrationsToInit = browserInit.mock.calls[0]![0]?.defaultIntegrations;
62-
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing');
63-
64-
expect(integrationsToInit).toContainEqual(expect.objectContaining({ name: 'BrowserTracing' }));
60+
const browserTracing = client?.getIntegrationByName('BrowserTracing');
6561
expect(browserTracing).toBeDefined();
6662
});
6763

6864
it("doesn't add browserTracingIntegration if `__SENTRY_TRACING__` is set to false", () => {
6965
(globalThis as any).__SENTRY_TRACING__ = false;
7066

71-
init({
67+
constclient=init({
7268
dsn: 'https://public@dsn.ingest.sentry.io/1337',
7369
tracesSampleRate: 1,
7470
});
7571

76-
const integrationsToInit = browserInit.mock.calls[0]![0]?.defaultIntegrations || [];
77-
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing');
78-
79-
expect(integrationsToInit).not.toContainEqual(expect.objectContaining({ name: 'BrowserTracing' }));
72+
const browserTracing = client?.getIntegrationByName('BrowserTracing');
8073
expect(browserTracing).toBeUndefined();
8174

8275
delete (globalThis as any).__SENTRY_TRACING__;
8376
});
8477

8578
it('Overrides the automatically default browserTracingIntegration instance with a a user-provided browserTracingIntegration instance', () => {
86-
init({
79+
constclient=init({
8780
dsn: 'https://public@dsn.ingest.sentry.io/1337',
8881
integrations: [
8982
browserTracingIntegration({ finalTimeout: 10, instrumentNavigation: false, instrumentPageLoad: false }),
9083
],
9184
tracesSampleRate: 1,
9285
});
9386

94-
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing');
87+
const browserTracing = client?.getIntegrationByName('BrowserTracing');
9588
expect(browserTracing).toBeDefined();
9689

9790
// no active span means the settings were respected

‎packages/aws-serverless/src/sdk.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
flush,
1414
getCurrentScope,
1515
getDefaultIntegrationsWithoutPerformance,
16-
initWithoutDefaultIntegrations,
16+
initWithDefaultIntegrations,
1717
startSpanManual,
1818
withScope,
1919
} from '@sentry/node';
@@ -77,13 +77,12 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
7777
*/
7878
export function init(options: NodeOptions = {}): NodeClient | undefined {
7979
const opts = {
80-
defaultIntegrations: getDefaultIntegrations(options),
8180
...options,
8281
};
8382

8483
applySdkMetadata(opts, 'aws-serverless');
8584

86-
return initWithoutDefaultIntegrations(opts);
85+
return initWithDefaultIntegrations(opts,getDefaultIntegrations);
8786
}
8887

8988
/** */

‎packages/aws-serverless/test/sdk.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ vi.mock('@sentry/node', async () => {
2525
const original = (await vi.importActual('@sentry/node')) as typeof import('@sentry/node');
2626
return {
2727
...original,
28-
initWithoutDefaultIntegrations: (options: unknown) => {
28+
initWithDefaultIntegrations: (options: unknown) => {
2929
mockInit(options);
3030
},
3131
startInactiveSpan: (...args: unknown[]) => {

‎packages/browser/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export * from './exports';
66

77
export { logger };
88

9+
export { initWithDefaultIntegrations } from './sdk';
10+
911
export { reportingObserverIntegration } from './integrations/reportingobserver';
1012
export { httpClientIntegration } from './integrations/httpclient';
1113
export { contextLinesIntegration } from './integrations/contextlines';

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /