Skip to content

Commit a5c4fcb

Browse files
authored
feat(v8/integrations): Merge integrations into core (#10799)
Move relevant integrations. Part of #9833
1 parent 519aacc commit a5c4fcb

File tree

85 files changed

+167
-526
lines changed

Some content is hidden

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

85 files changed

+167
-526
lines changed

.craft.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ targets:
7070
- name: npm
7171
id: '@sentry/wasm'
7272
includeNames: /^sentry-wasm-\d.*\.tgz$/
73-
- name: npm
74-
id: '@sentry/integrations'
75-
includeNames: /^sentry-integrations-\d.*\.tgz$/
7673

7774
## 4. WinterCG Packages
7875
- name: npm

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ jobs:
101101
- 'packages/tracing-internal/**'
102102
- 'packages/utils/**'
103103
- 'packages/types/**'
104-
- 'packages/integrations/**'
105104
browser: &browser
106105
- *shared
107106
- 'packages/browser/**'
@@ -424,7 +423,6 @@ jobs:
424423
name: ${{ github.sha }}
425424
path: |
426425
${{ github.workspace }}/packages/browser/build/bundles/**
427-
${{ github.workspace }}/packages/integrations/build/bundles/**
428426
${{ github.workspace }}/packages/replay/build/bundles/**
429427
${{ github.workspace }}/packages/replay-canvas/build/bundles/**
430428
${{ github.workspace }}/packages/**/*.tgz

MIGRATION.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,26 @@ Sentry SDK requires the fetch API to be available in the environment.
112112
[`error.cause`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) by
113113
default.
114114

115+
## Integrations
116+
117+
We moved pluggable integrations from their own package (`@sentry/integrations`) to `@sentry/browser` and `@sentry/node`.
118+
119+
Integrations that are now exported from `@sentry/browser` (or framework-specific packages like `@sentry/react`):
120+
121+
- httpClientIntegration
122+
- contextLinesIntegration
123+
- reportingObserverIntegration
124+
125+
Integrations that are now exported from `@sentry/node` and `@sentry/browser` (or framework-specific packages like
126+
`@sentry/react`):
127+
128+
- captureConsoleIntegration
129+
- debugIntegration
130+
- extraErrorDataIntegration
131+
- rewriteFramesIntegration
132+
- sessionTimingIntegration
133+
- dedupeIntegration (enabled by default, not pluggable)
134+
115135
# Deprecations in 7.x
116136

117137
You can use the **Experimental** [@sentry/migr8](https://www.npmjs.com/package/@sentry/migr8) to automatically update

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ package. Please refer to the README and instructions of those SDKs for more deta
5757
- [`@sentry/gatsby`](https://github.com/getsentry/sentry-javascript/tree/master/packages/gatsby): SDK for Gatsby
5858
- [`@sentry/nextjs`](https://github.com/getsentry/sentry-javascript/tree/master/packages/nextjs): SDK for Next.js
5959
- [`@sentry/remix`](https://github.com/getsentry/sentry-javascript/tree/master/packages/remix): SDK for Remix
60-
- [`@sentry/integrations`](https://github.com/getsentry/sentry-javascript/tree/master/packages/integrations): Pluggable
61-
integrations that can be used to enhance JS SDKs
6260
- [`@sentry/serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/serverless): SDK for
6361
Serverless Platforms (AWS, GCP)
6462
- [`@sentry/electron`](https://github.com/getsentry/sentry-electron): SDK for Electron with support for native crashes

dev-packages/browser-integration-tests/suites/integrations/ContextLines/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Sentry from '@sentry/browser';
2-
import { contextLinesIntegration } from '@sentry/integrations';
2+
import { contextLinesIntegration } from '@sentry/browser';
33

44
window.Sentry = Sentry;
55

dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Sentry from '@sentry/browser';
2-
import { httpClientIntegration } from '@sentry/integrations';
2+
import { httpClientIntegration } from '@sentry/browser';
33

44
window.Sentry = Sentry;
55

dev-packages/browser-integration-tests/suites/integrations/httpclient/httpClientIntegration/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Sentry from '@sentry/browser';
2-
import { httpClientIntegration } from '@sentry/integrations';
2+
import { httpClientIntegration } from '@sentry/browser';
33

44
window.Sentry = Sentry;
55

dev-packages/browser-integration-tests/suites/integrations/httpclient/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Sentry from '@sentry/browser';
2-
import { httpClientIntegration } from '@sentry/integrations';
2+
import { httpClientIntegration } from '@sentry/browser';
33

44
window.Sentry = Sentry;
55

dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import {
22
Breadcrumbs,
33
BrowserClient,
4-
Dedupe,
54
FunctionToString,
65
HttpContext,
76
Hub,
87
InboundFilters,
98
LinkedErrors,
9+
dedupeIntegration,
1010
defaultStackParser,
1111
makeFetchTransport,
1212
} from '@sentry/browser';
1313

1414
const integrations = [
1515
new Breadcrumbs(),
1616
new FunctionToString(),
17-
new Dedupe(),
17+
dedupeIntegration(),
1818
new HttpContext(),
1919
new InboundFilters(),
2020
new LinkedErrors(),

dev-packages/browser-integration-tests/utils/generatePlugin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ class SentryScenarioGenerationPlugin {
169169
// To help Webpack resolve Sentry modules in `import` statements in cases where they're provided in bundles rather than in `node_modules`
170170
'@sentry/browser': 'Sentry',
171171
'@sentry/replay': 'Sentry',
172-
'@sentry/integrations': 'Sentry',
173172
'@sentry/wasm': 'Sentry',
174173
}
175174
: {};
@@ -242,7 +241,7 @@ class SentryScenarioGenerationPlugin {
242241
this.localOutPath,
243242
path.resolve(
244243
PACKAGES_DIR,
245-
'integrations',
244+
'browser',
246245
BUNDLE_PATHS['integrations'][integrationBundleKey].replace('[INTEGRATION_NAME]', integration),
247246
),
248247
fileName,

dev-packages/e2e-tests/test-applications/generic-ts3.8/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import * as _SentryBrowser from '@sentry/browser';
33
// biome-ignore lint/nursery/noUnusedImports:
44
import * as _SentryCore from '@sentry/core';
55
// biome-ignore lint/nursery/noUnusedImports:
6-
import * as _SentryIntegrations from '@sentry/integrations';
7-
// biome-ignore lint/nursery/noUnusedImports:
86
import * as _SentryNode from '@sentry/node';
97
// biome-ignore lint/nursery/noUnusedImports:
108
import * as _SentryOpentelemetry from '@sentry/opentelemetry-node';

dev-packages/e2e-tests/test-applications/generic-ts3.8/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"dependencies": {
1616
"@sentry/browser": "latest || *",
1717
"@sentry/core": "latest || *",
18-
"@sentry/integrations": "latest || *",
1918
"@sentry/node": "latest || *",
2019
"@sentry/opentelemetry-node": "latest || *",
2120
"@sentry/replay": "latest || *",

dev-packages/e2e-tests/test-applications/node-express-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"test:assert": "pnpm test"
1212
},
1313
"dependencies": {
14-
"@sentry/integrations": "latest || *",
1514
"@sentry/node": "latest || *",
1615
"@sentry/types": "latest || *",
1716
"express": "4.18.2",

dev-packages/e2e-tests/test-applications/node-express-app/src/app.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { httpClientIntegration } from '@sentry/integrations';
21
import * as Sentry from '@sentry/node';
32
import express from 'express';
43

@@ -12,7 +11,6 @@ Sentry.init({
1211
environment: 'qa', // dynamic sampling bias to keep transactions
1312
dsn: process.env.E2E_TEST_DSN,
1413
includeLocalVariables: true,
15-
integrations: [httpClientIntegration()],
1614
debug: true,
1715
tunnel: `http://localhost:3031/`, // proxy server
1816
tracesSampleRate: 1,

dev-packages/e2e-tests/test-applications/node-hapi-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
},
1313
"dependencies": {
1414
"@hapi/hapi": "21.3.2",
15-
"@sentry/integrations": "latest || *",
1615
"@sentry/node": "latest || *",
1716
"@sentry/types": "latest || *",
1817
"@types/node": "18.15.1",

dev-packages/e2e-tests/verdaccio-config/config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ packages:
8686
unpublish: $all
8787
# proxy: npmjs # Don't proxy for E2E tests!
8888

89-
'@sentry/integrations':
90-
access: $all
91-
publish: $all
92-
unpublish: $all
93-
# proxy: npmjs # Don't proxy for E2E tests!
94-
9589
'@sentry/nextjs':
9690
access: $all
9791
publish: $all

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function makeBaseBundleConfig(options) {
5959
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin],
6060
};
6161

62-
// used by `@sentry/integrations` and `@sentry/wasm` (bundles which need to be combined with a stand-alone SDK bundle)
62+
// used by `@sentry/wasm` & pluggable integrations from core/browser (bundles which need to be combined with a stand-alone SDK bundle)
6363
const addOnBundleConfig = {
6464
// These output settings are designed to mimic an IIFE. We don't use Rollup's `iife` format because we don't want to
6565
// attach this code to a new global variable, but rather inject it into the existing SDK's `Integrations` object.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"packages/eslint-plugin-sdk",
5858
"packages/feedback",
5959
"packages/gatsby",
60-
"packages/integrations",
6160
"packages/integration-shims",
6261
"packages/nextjs",
6362
"packages/node",

packages/astro/src/index.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export declare function init(options: Options | clientSdk.BrowserOptions | serve
1818
export declare const Integrations: typeof serverSdk.Integrations;
1919

2020
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
21+
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
2122

2223
export declare const getDefaultIntegrations: (options: Options) => Integration[];
2324
export declare const defaultStackParser: StackParser;

packages/browser/rollup.bundle.config.mjs

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

11+
const browserPluggableIntegrationFiles = ['contextlines', 'httpclient', 'reportingobserver'];
12+
13+
const corePluggableIntegrationFiles = [
14+
'captureconsole',
15+
'debug',
16+
'dedupe',
17+
'extraerrordata',
18+
'rewriteframes',
19+
'sessiontiming',
20+
];
21+
1122
targets.forEach(jsVersion => {
1223
const baseBundleConfig = makeBaseBundleConfig({
1324
bundleType: 'standalone',
@@ -25,6 +36,30 @@ targets.forEach(jsVersion => {
2536
outputFileBase: () => `bundles/bundle.tracing${jsVersion === 'es5' ? '.es5' : ''}`,
2637
});
2738

39+
browserPluggableIntegrationFiles.forEach(integrationName => {
40+
const integrationsBundleConfig = makeBaseBundleConfig({
41+
bundleType: 'addon',
42+
entrypoints: [`src/integrations/${integrationName}.ts`],
43+
jsVersion,
44+
licenseTitle: `@sentry/browser - ${integrationName}`,
45+
outputFileBase: () => `bundles/${integrationName}${jsVersion === 'es5' ? '.es5' : ''}`,
46+
});
47+
48+
builds.push(...makeBundleConfigVariants(integrationsBundleConfig));
49+
});
50+
51+
corePluggableIntegrationFiles.forEach(integrationName => {
52+
const integrationsBundleConfig = makeBaseBundleConfig({
53+
bundleType: 'addon',
54+
entrypoints: [`src/integrations-bundle/index.${integrationName}.ts`],
55+
jsVersion,
56+
licenseTitle: `@sentry/browser - ${integrationName}`,
57+
outputFileBase: () => `bundles/${integrationName}${jsVersion === 'es5' ? '.es5' : ''}`,
58+
});
59+
60+
builds.push(...makeBundleConfigVariants(integrationsBundleConfig));
61+
});
62+
2863
builds.push(...makeBundleConfigVariants(baseBundleConfig), ...makeBundleConfigVariants(tracingBaseBundleConfig));
2964
});
3065

packages/browser/src/exports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export {
6666
InboundFilters,
6767
functionToStringIntegration,
6868
inboundFiltersIntegration,
69+
dedupeIntegration,
6970
parameterize,
7071
startSession,
7172
captureSession,
@@ -108,11 +109,10 @@ export {
108109
} from './sdk';
109110

110111
export { breadcrumbsIntegration } from './integrations/breadcrumbs';
111-
export { dedupeIntegration } from './integrations/dedupe';
112112
export { globalHandlersIntegration } from './integrations/globalhandlers';
113113
export { httpContextIntegration } from './integrations/httpcontext';
114114
export { linkedErrorsIntegration } from './integrations/linkederrors';
115115
export { browserApiErrorsIntegration } from './integrations/browserapierrors';
116116

117117
// eslint-disable-next-line deprecation/deprecation
118-
export { Breadcrumbs, LinkedErrors, HttpContext, Dedupe } from './integrations';
118+
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ 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+
extraErrorDataIntegration,
34+
rewriteFramesIntegration,
35+
sessionTimingIntegration,
36+
} from '@sentry/core';
37+
2638
export {
2739
// eslint-disable-next-line deprecation/deprecation
2840
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';

0 commit comments

Comments
 (0)