Skip to content

Commit 793ad71

Browse files
authored
feat(bun): Export bunServerIntegration() (#10439)
And deprecate `new BunServer()`
1 parent 3e148e6 commit 793ad71

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

packages/bun/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ export {
128128

129129
import { Integrations as CoreIntegrations } from '@sentry/core';
130130
import { Integrations as NodeIntegrations } from '@sentry/node';
131-
132-
import * as BunIntegrations from './integrations';
131+
import { BunServer } from './integrations/bunserver';
132+
export { bunServerIntegration } from './integrations/bunserver';
133133

134134
const INTEGRATIONS = {
135135
// eslint-disable-next-line deprecation/deprecation
136136
...CoreIntegrations,
137137
// eslint-disable-next-line deprecation/deprecation
138138
...NodeIntegrations,
139-
...BunIntegrations,
139+
BunServer,
140140
};
141141

142142
export { INTEGRATIONS as Integrations };

packages/bun/src/integrations/bunserver.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
captureException,
66
continueTrace,
77
convertIntegrationFnToClass,
8+
defineIntegration,
89
getCurrentScope,
910
runWithAsyncContext,
1011
setHttpStatus,
@@ -15,7 +16,7 @@ import { getSanitizedUrlString, parseUrl } from '@sentry/utils';
1516

1617
const INTEGRATION_NAME = 'BunServer';
1718

18-
const bunServerIntegration = (() => {
19+
const _bunServerIntegration = (() => {
1920
return {
2021
name: INTEGRATION_NAME,
2122
setupOnce() {
@@ -24,8 +25,12 @@ const bunServerIntegration = (() => {
2425
};
2526
}) satisfies IntegrationFn;
2627

28+
export const bunServerIntegration = defineIntegration(_bunServerIntegration);
29+
2730
/**
2831
* Instruments `Bun.serve` to automatically create transactions and capture errors.
32+
*
33+
* @deprecated Use `bunServerIntegration()` instead.
2934
*/
3035
// eslint-disable-next-line deprecation/deprecation
3136
export const BunServer = convertIntegrationFnToClass(INTEGRATION_NAME, bunServerIntegration);

packages/bun/src/integrations/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/bun/src/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import type { Integration, Options } from '@sentry/types';
1818

1919
import { BunClient } from './client';
20-
import { BunServer } from './integrations';
20+
import { bunServerIntegration } from './integrations/bunserver';
2121
import { makeFetchTransport } from './transports';
2222
import type { BunOptions } from './types';
2323

@@ -41,7 +41,7 @@ export const defaultIntegrations = [
4141
nodeContextIntegration(),
4242
modulesIntegration(),
4343
// Bun Specific
44-
new BunServer(),
44+
bunServerIntegration(),
4545
];
4646

4747
/** Get the default integrations for the Bun SDK. */

0 commit comments

Comments
 (0)