From eb59bc8f83ffb7effe102d378beb76a288418ea0 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 29 Jan 2024 16:41:16 +0100 Subject: [PATCH 1/3] feat(bun): Add missing `@sentry/node` re-exports --- .../node-exports-test-app/package.json | 5 +++-- .../scripts/consistentExports.ts | 13 ++++++++++++- packages/bun/src/index.ts | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json b/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json index 056dd6836e61..21ee1c3e7d89 100644 --- a/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json +++ b/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json @@ -5,8 +5,8 @@ "type": "module", "scripts": { "build": "tsc", - "start": "pnpm build && node dist/consistentExports.js", - "test": " node dist/consistentExports.js", + "start": "pnpm build && bun run ./dist/consistentExports.js", + "test": " bun run ./dist/consistentExports.js", "clean": "npx rimraf node_modules,pnpm-lock.yaml,dist", "test:build": "pnpm install && pnpm build", "test:assert": "pnpm test" @@ -20,6 +20,7 @@ "@sentry/serverless": "latest || *", "@sentry/bun": "latest || *", "@sentry/types": "latest || *", + "@sentry/core": "latest || *", "@types/node": "18.15.1", "typescript": "4.9.5" }, diff --git a/dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts b/dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts index a488ef463412..c7afa6f53863 100644 --- a/dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts +++ b/dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts @@ -1,5 +1,5 @@ import * as SentryAstro from '@sentry/astro'; -// import * as SentryBun from '@sentry/bun'; +import * as SentryBun from '@sentry/bun'; import * as SentryNextJs from '@sentry/nextjs'; import * as SentryNode from '@sentry/node'; import * as SentryRemix from '@sentry/remix'; @@ -38,6 +38,17 @@ const DEPENDENTS: Dependent[] = [ package: '@sentry/astro', exports: Object.keys(SentryAstro), }, + { + package: '@sentry/bun', + exports: Object.keys(SentryBun), + ignoreExports: [ + // not supported in bun: + 'Handlers', + 'NodeClient', + 'hapiErrorPlugin', + 'makeNodeTransport', + ], + }, { package: '@sentry/nextjs', // Next.js doesn't require explicit exports, so we can just merge top level and `default` exports: diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index 9869a52caaa9..5742597485e0 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -89,7 +89,22 @@ export { parameterize, } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; -export { autoDiscoverNodePerformanceMonitoringIntegrations, cron } from '@sentry/node'; +export { + // eslint-disable-next-line deprecation/deprecation + deepReadDirSync, + // eslint-disable-next-line deprecation/deprecation + enableAnrDetection, + // eslint-disable-next-line deprecation/deprecation + getModuleFromFilename, + DEFAULT_USER_INCLUDES, + autoDiscoverNodePerformanceMonitoringIntegrations, + cron, + createGetModuleFromFilename, + defaultStackParser, + extractRequestData, + getSentryRelease, + addRequestDataToEvent, +} from '@sentry/node'; export { BunClient } from './client'; export { From fd2fea9a35ed73e0f50b098fd5fe2fffde522d92 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 29 Jan 2024 16:44:21 +0100 Subject: [PATCH 2/3] bun in ci --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00459abbe701..62b713e73def 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -947,6 +947,9 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: 'dev-packages/e2e-tests/package.json' + - name: Set up Bun + if: matrix.test-application == 'node-exports-test-app' + uses: oven-sh/setup-bun@v1 - name: Restore caches uses: ./.github/actions/restore-cache env: From 787fd8f707d453580af36c285e90e45867c48dce Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 29 Jan 2024 16:47:24 +0100 Subject: [PATCH 3/3] rm sentry/core --- .../test-applications/node-exports-test-app/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json b/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json index 21ee1c3e7d89..8965bb7de982 100644 --- a/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json +++ b/dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json @@ -20,7 +20,6 @@ "@sentry/serverless": "latest || *", "@sentry/bun": "latest || *", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", "@types/node": "18.15.1", "typescript": "4.9.5" },