Skip to content

Commit 43aee1d

Browse files
committed
export browser integrations from core
1 parent 4c54f7f commit 43aee1d

19 files changed

+56
-203
lines changed

packages/browser/rollup.bundle.config.mjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ if (targets.some(target => target !== 'es5' && target !== 'es6')) {
88
throw new Error('JS_VERSION must be either "es5" or "es6"');
99
}
1010

11+
const addonIntegrationFiles = ['contextlines', 'httpclient', 'reportingobserver'];
12+
13+
const coreIntegrationFiles = ['captureconsole', 'debug', 'dedupe', 'extraerrordata', 'rewriteframes', 'sessiontiming'];
14+
1115
targets.forEach(jsVersion => {
1216
const baseBundleConfig = makeBaseBundleConfig({
1317
bundleType: 'standalone',
@@ -25,6 +29,30 @@ targets.forEach(jsVersion => {
2529
outputFileBase: () => `bundles/bundle.tracing${jsVersion === 'es5' ? '.es5' : ''}`,
2630
});
2731

32+
addonIntegrationFiles.forEach(integrationName => {
33+
const integrationsBundleConfig = makeBaseBundleConfig({
34+
bundleType: 'addon',
35+
entrypoints: [`src/integrations/${integrationName}.ts`],
36+
jsVersion,
37+
licenseTitle: `@sentry/browser - ${integrationName}`,
38+
outputFileBase: () => `bundles/${integrationName}${jsVersion === 'es5' ? '.es5' : ''}`,
39+
});
40+
41+
builds.push(...makeBundleConfigVariants(integrationsBundleConfig));
42+
});
43+
44+
coreIntegrationFiles.forEach(integrationName => {
45+
const integrationsBundleConfig = makeBaseBundleConfig({
46+
bundleType: 'addon',
47+
entrypoints: [`src/integrations-bundle/index.${integrationName}.ts`],
48+
jsVersion,
49+
licenseTitle: `@sentry/browser - ${integrationName}`,
50+
outputFileBase: () => `bundles/${integrationName}${jsVersion === 'es5' ? '.es5' : ''}`,
51+
});
52+
53+
builds.push(...makeBundleConfigVariants(integrationsBundleConfig));
54+
});
55+
2856
builds.push(...makeBundleConfigVariants(baseBundleConfig), ...makeBundleConfigVariants(tracingBaseBundleConfig));
2957
});
3058

packages/browser/src/exports.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,10 @@ export {
108108
} from './sdk';
109109

110110
export { breadcrumbsIntegration } from './integrations/breadcrumbs';
111-
export { dedupeIntegration } from './integrations/dedupe';
112111
export { globalHandlersIntegration } from './integrations/globalhandlers';
113112
export { httpContextIntegration } from './integrations/httpcontext';
114113
export { linkedErrorsIntegration } from './integrations/linkederrors';
115114
export { browserApiErrorsIntegration } from './integrations/browserapierrors';
116115

117116
// eslint-disable-next-line deprecation/deprecation
118-
export { Breadcrumbs, LinkedErrors, HttpContext, Dedupe } from './integrations';
117+
export { Breadcrumbs, LinkedErrors, HttpContext } from './integrations';

packages/browser/src/index.bundle.base.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { IntegrationFn } from '@sentry/types/src';
2+
13
export * from './exports';
24

35
import { Integrations as CoreIntegrations } from '@sentry/core';
@@ -14,7 +16,7 @@ if (WINDOW.Sentry && WINDOW.Sentry.Integrations) {
1416
}
1517

1618
// eslint-disable-next-line @typescript-eslint/no-explicit-any
17-
const INTEGRATIONS: Record<string, new (...args: any[]) => Integration> = {
19+
const INTEGRATIONS: Record<string, (new (...args: any[]) => Integration) | IntegrationFn> = {
1820
...windowIntegrations,
1921
// eslint-disable-next-line deprecation/deprecation
2022
...CoreIntegrations,

packages/browser/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ const INTEGRATIONS = {
2323
// eslint-disable-next-line deprecation/deprecation
2424
export { INTEGRATIONS as Integrations };
2525

26+
export { reportingObserverIntegration } from './integrations/reportingobserver';
27+
export { httpClientIntegration } from './integrations/httpclient';
28+
export { contextLinesIntegration } from './integrations/contextlines';
29+
30+
export {
31+
captureConsoleIntegration,
32+
debugIntegration,
33+
dedupeIntegration,
34+
extraErrorDataIntegration,
35+
rewriteFramesIntegration,
36+
sessionTimingIntegration,
37+
} from '@sentry/core';
38+
2639
export {
2740
// eslint-disable-next-line deprecation/deprecation
2841
Replay,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { captureConsoleIntegration } from '@sentry/core';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { debugIntegration } from '@sentry/core';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { dedupeIntegration } from '@sentry/core';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { extraErrorDataIntegration } from '@sentry/core';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { rewriteFramesIntegration } from '@sentry/core';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { sessionTimingIntegration } from '@sentry/core';

packages/browser/src/integrations/dedupe.ts

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

packages/integrations/src/httpclient.ts renamed to packages/browser/src/integrations/httpclient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
supportsNativeFetch,
1111
} from '@sentry/utils';
1212

13-
import { DEBUG_BUILD } from './debug-build';
13+
import { DEBUG_BUILD } from '../debug-build';
1414

1515
export type HttpStatusCodeRange = [number, number] | number;
1616
export type HttpRequestTarget = string | RegExp;

packages/browser/src/integrations/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
export { Breadcrumbs } from './breadcrumbs';
33
export { LinkedErrors } from './linkederrors';
44
export { HttpContext } from './httpcontext';
5-
export { Dedupe } from './dedupe';

packages/browser/src/sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import {
1616
supportsFetch,
1717
} from '@sentry/utils';
1818

19+
import { dedupeIntegration } from '@sentry/core';
1920
import type { BrowserClientOptions, BrowserOptions } from './client';
2021
import { BrowserClient } from './client';
2122
import { DEBUG_BUILD } from './debug-build';
2223
import { WINDOW, wrap as internalWrap } from './helpers';
2324
import { breadcrumbsIntegration } from './integrations/breadcrumbs';
2425
import { browserApiErrorsIntegration } from './integrations/browserapierrors';
25-
import { dedupeIntegration } from './integrations/dedupe';
2626
import { globalHandlersIntegration } from './integrations/globalhandlers';
2727
import { httpContextIntegration } from './integrations/httpcontext';
2828
import { linkedErrorsIntegration } from './integrations/linkederrors';

packages/browser/test/unit/index.bundle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as TracingBundle from '../../src/index.bundle';
1111
describe('index.bundle', () => {
1212
it('has correct exports', () => {
1313
Object.keys(TracingBundle.Integrations).forEach(key => {
14-
expect((TracingBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String));
14+
expect((TracingBundle.Integrations[key] as any).name).toStrictEqual(expect.any(String));
1515
});
1616

1717
expect(TracingBundle.Integrations.Replay).toBe(ReplayShim);

packages/integrations/test/contextlines.test.ts renamed to packages/browser/test/unit/integrations/contextlines.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { StackFrame } from '@sentry/types';
22

3-
import { applySourceContextToFrame } from '../src/contextlines';
3+
import { applySourceContextToFrame } from '../../../src/integrations/contextlines';
44

55
const lines = ['line1', 'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8', 'line9'];
66
describe('ContextLines', () => {

packages/integrations/test/reportingobserver.test.ts renamed to packages/browser/test/unit/integrations/reportingobserver.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as SentryCore from '@sentry/core';
22
import type { Client } from '@sentry/types';
33

4-
import { reportingObserverIntegration } from '../src/reportingobserver';
4+
import { reportingObserverIntegration } from '../../../src/integrations/reportingobserver';
55

66
const mockScope = {
77
setExtra: jest.fn(),

0 commit comments

Comments
 (0)