Skip to content

Commit

Permalink
feat: Export pluggable integrations from SDK packages (#11723)
Browse files Browse the repository at this point in the history
This exports the functional integrations from `@sentry/integrations`
from each package.

In v8, the `@sentry/integrations` package will be gone, and the
migration path is to just use it from the SDK package itself.
  • Loading branch information
mydea committed Apr 23, 2024
1 parent 8be252e commit da5ba09
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ export {
functionToStringIntegration,
inboundFiltersIntegration,
linkedErrorsIntegration,
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
Handlers,
trpcMiddleware,
setMeasurement,
Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export declare function init(options: Options | clientSdk.BrowserOptions | serve
export declare const Integrations: typeof clientSdk.Integrations & typeof serverSdk.Integrations;

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

export declare const defaultIntegrations: Integration[];
export declare const getDefaultIntegrations: (options: Options) => Integration[];
Expand Down
1 change: 1 addition & 0 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@sentry-internal/replay-canvas": "7.111.0",
"@sentry-internal/tracing": "7.111.0",
"@sentry/core": "7.111.0",
"@sentry/integrations": "7.111.0",
"@sentry/replay": "7.111.0",
"@sentry/types": "7.111.0",
"@sentry/utils": "7.111.0"
Expand Down
12 changes: 12 additions & 0 deletions packages/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ export {
sendFeedback,
} from '@sentry-internal/feedback';

export {
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
contextLinesIntegration,
} from '@sentry/integrations';

export {
// eslint-disable-next-line deprecation/deprecation
BrowserTracing,
Expand Down
8 changes: 8 additions & 0 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ export {
onUncaughtExceptionIntegration,
onUnhandledRejectionIntegration,
spotlightIntegration,
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
Expand Down
1 change: 1 addition & 0 deletions packages/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"@sentry/browser": "7.111.0",
"@sentry/core": "7.111.0",
"@sentry/integrations": "7.111.0",
"@sentry/types": "7.111.0",
"@sentry/utils": "7.111.0"
},
Expand Down
10 changes: 10 additions & 0 deletions packages/deno/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ export {
export { breadcrumbsIntegration, dedupeIntegration } from '@sentry/browser';
import { Integrations as CoreIntegrations } from '@sentry/core';

export {
captureConsoleIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
} from '@sentry/integrations';

export { denoContextIntegration } from './integrations/context';
export { globalHandlersIntegration } from './integrations/globalhandlers';
export { normalizePathsIntegration } from './integrations/normalizepaths';
Expand Down
1 change: 0 additions & 1 deletion packages/integrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"localforage": "^1.8.1"
},
"devDependencies": {
"@sentry/browser": "7.111.0",
"chai": "^4.1.2"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/src/offline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable deprecation/deprecation */
import type { Event, EventProcessor, Hub, Integration } from '@sentry/types';
import { GLOBAL_OBJ, logger, normalize, uuid4 } from '@sentry/utils';
import localForage from 'localforage';
import * as localForage from 'localforage';

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

Expand Down
4 changes: 3 additions & 1 deletion packages/integrations/test/offline.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* eslint-disable deprecation/deprecation */
import { WINDOW } from '@sentry/browser';
import type { Event, EventProcessor, Hub, Integration, IntegrationClass } from '@sentry/types';
import { GLOBAL_OBJ } from '@sentry/utils';

import type { Item } from '../src/offline';
import { Offline } from '../src/offline';

const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;

// mock localforage methods
jest.mock('localforage', () => ({
createInstance(_options: { name: string }): any {
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export declare const Integrations: typeof clientSdk.Integrations &
typeof edgeSdk.Integrations;

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

export declare const defaultIntegrations: Integration[];
export declare const getDefaultIntegrations: (options: Options) => Integration[];
Expand Down
1 change: 1 addition & 0 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"dependencies": {
"@sentry-internal/tracing": "7.111.0",
"@sentry/core": "7.111.0",
"@sentry/integrations": "7.111.0",
"@sentry/types": "7.111.0",
"@sentry/utils": "7.111.0"
},
Expand Down
11 changes: 11 additions & 0 deletions packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ export const Integrations = {
...TracingIntegrations,
};

export {
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
} from '@sentry/integrations';

export { consoleIntegration } from './integrations/console';
export { onUncaughtExceptionIntegration } from './integrations/onuncaughtexception';
export { onUnhandledRejectionIntegration } from './integrations/onunhandledrejection';
Expand Down
8 changes: 8 additions & 0 deletions packages/remix/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ export {
functionToStringIntegration,
inboundFiltersIntegration,
linkedErrorsIntegration,
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
Handlers,
trpcMiddleware,
setMeasurement,
Expand Down
1 change: 1 addition & 0 deletions packages/remix/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export declare function init(options: RemixOptions): void;
export declare const Integrations: typeof clientSdk.Integrations & typeof serverSdk.Integrations;

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

export declare const defaultIntegrations: Integration[];
export declare const getDefaultIntegrations: (options: Options) => Integration[];
Expand Down
8 changes: 8 additions & 0 deletions packages/serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ export {
httpIntegration,
nativeNodeFetchintegration,
spotlightIntegration,
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export declare function wrapLoadWithSentry<T extends (...args: any) => any>(orig
export declare const Integrations: typeof clientSdk.Integrations & typeof serverSdk.Integrations;

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

export declare const defaultIntegrations: Integration[];
export declare const getDefaultIntegrations: (options: Options) => Integration[];
Expand Down
8 changes: 8 additions & 0 deletions packages/sveltekit/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export {
functionToStringIntegration,
inboundFiltersIntegration,
linkedErrorsIntegration,
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
Handlers,
trpcMiddleware,
setMeasurement,
Expand Down
1 change: 1 addition & 0 deletions packages/vercel-edge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"dependencies": {
"@sentry-internal/tracing": "7.111.0",
"@sentry/core": "7.111.0",
"@sentry/integrations": "7.111.0",
"@sentry/types": "7.111.0",
"@sentry/utils": "7.111.0"
},
Expand Down
12 changes: 12 additions & 0 deletions packages/vercel-edge/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ export {
init,
} from './sdk';

export {
captureConsoleIntegration,
dedupeIntegration,
debugIntegration,
extraErrorDataIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
httpClientIntegration,
contextLinesIntegration,
} from '@sentry/integrations';

import { Integrations as CoreIntegrations, RequestData } from '@sentry/core';

import { WinterCGFetch } from './integrations/wintercg-fetch';
Expand Down

0 comments on commit da5ba09

Please sign in to comment.