Skip to content

Commit e32bdf9

Browse files
mydeaclaude
andcommitted
ref(core)!: Split browser/server-only exports out of the default entrypoint
`@sentry/core` now exposes only isomorphic code. The `/browser` and `/server` entrypoints contain only their platform-specific exports instead of also re-exporting the full shared surface, and consumer packages import platform-specific symbols from the matching entrypoint. A `no-unguarded-span-apis` lint rule enforces that browser-facing code imports the span-start APIs from `@sentry/core/browser` (the guarded variant), never from `@sentry/core`/`@sentry/core/server`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3519e74 commit e32bdf9

155 files changed

Lines changed: 898 additions & 963 deletions

File tree

Some content is hidden

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

‎packages/astro/src/server/middleware.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { HTTP_SERVER } from '@sentry/conventions/op';
1212
import type { Span, SpanAttributes } from '@sentry/core';
1313
import {
1414
addNonEnumerableProperty,
15-
flushIfServerless,
1615
getIsolationScope,
1716
getRootSpan,
1817
getUrlFragment,
@@ -26,6 +25,7 @@ import {
2625
filterCollectedUrl,
2726
filterCollectedUrlQuery,
2827
} from '@sentry/core';
28+
import { flushIfServerless } from '@sentry/core/server';
2929
import {
3030
captureException,
3131
continueTrace,

‎packages/browser-utils/src/performance/utils.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { SentrySpan, Span, SpanTimeInput, StartSpanOptions } from '@sentry/core';
2-
import { spanToStaticSpanJSON, withActiveSpan, startInactiveSpan } from '@sentry/core/browser';
2+
import { spanToStaticSpanJSON, withActiveSpan } from '@sentry/core';
3+
import { startInactiveSpan } from '@sentry/core/browser';
34
import { WINDOW } from '../types';
45

56
/**

‎packages/browser-utils/src/types.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { FetchBreadcrumbHint, HandlerDataFetch, XhrBreadcrumbHint } from '@sentry/core';
1+
import type { FetchBreadcrumbHint, HandlerDataFetch } from '@sentry/core';
2+
import type { XhrBreadcrumbHint } from '@sentry/core/browser';
23
import { GLOBAL_OBJ } from '@sentry/core';
34

45
export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ &

‎packages/browser/src/client.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type {
2-
BrowserClientReplayOptions,
32
ClientOptions,
43
Event,
54
EventHint,
65
Options as CoreOptions,
76
ParameterizedString,
87
Scope,
98
SeverityLevel,
10-
} from '@sentry/core/browser';
11-
import { addAutoIpAddressToSession, applySdkMetadata, Client, getSDKSource } from '@sentry/core/browser';
9+
} from '@sentry/core';
10+
import type { BrowserClientReplayOptions } from '@sentry/core/browser';
11+
import { addAutoIpAddressToSession, applySdkMetadata, Client, getSDKSource } from '@sentry/core';
1212
import { eventFromException, eventFromMessage } from './eventbuilder';
1313
import { WINDOW } from './helpers';
1414
import type { BrowserTransportOptions } from './transports/types';

‎packages/browser/src/diagnose-sdk.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getClient, suppressTracing } from '@sentry/core/browser';
1+
import { getClient, suppressTracing } from '@sentry/core';
22

33
/**
44
* A function to diagnose why the SDK might not be successfully sending data.

‎packages/browser/src/eventbuilder.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
SeverityLevel,
77
StackFrame,
88
StackParser,
9-
} from '@sentry/core/browser';
9+
} from '@sentry/core';
1010
import {
1111
_INTERNAL_enhanceErrorWithSentryInfo,
1212
addExceptionMechanism,
@@ -22,7 +22,7 @@ import {
2222
isPlainObject,
2323
normalizeToSize,
2424
resolvedSyncPromise,
25-
} from '@sentry/core/browser';
25+
} from '@sentry/core';
2626

2727
type Prototype = { constructor: (...args: unknown[]) => unknown };
2828

‎packages/browser/src/exports.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type {
2020
ExclusiveEventHintOrCaptureContext,
2121
Log,
2222
LogSeverityLevel,
23-
} from '@sentry/core/browser';
23+
} from '@sentry/core';
2424

2525
export type { BrowserOptions } from './client';
2626

@@ -74,14 +74,14 @@ export {
7474
withStaticSpan,
7575
// oxlint-disable-next-line typescript/no-deprecated
7676
withStreamedSpan,
77-
} from '@sentry/core/browser';
77+
} from '@sentry/core';
7878

7979
export {
8080
SEMANTIC_ATTRIBUTE_SENTRY_OP,
8181
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
8282
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
8383
SENTRY_SEGMENT_NAME_SOURCE,
84-
} from '@sentry/core/browser';
84+
} from '@sentry/core';
8585

8686
export { WINDOW } from './helpers';
8787
export { BrowserClient } from './client';

‎packages/browser/src/helpers.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Mechanism, WrappedFunction } from '@sentry/core/browser';
1+
import type { Mechanism, WrappedFunction } from '@sentry/core';
22
import {
33
addExceptionMechanism,
44
addExceptionTypeValue,
@@ -8,7 +8,7 @@ import {
88
GLOBAL_OBJ,
99
markFunctionWrapped,
1010
withScope,
11-
} from '@sentry/core/browser';
11+
} from '@sentry/core';
1212
import { getLocationHref } from '@sentry/browser-utils';
1313

1414
export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;

‎packages/browser/src/index.bundle.logs.metrics.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88

99
export * from './index.bundle.base';
1010

11-
export { logger, consoleLoggingIntegration, metrics } from '@sentry/core/browser';
11+
export { logger, consoleLoggingIntegration, metrics } from '@sentry/core';
1212

1313
export { elementTimingIntegration } from '@sentry/browser-utils';
1414

‎packages/browser/src/index.bundle.replay.logs.metrics.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77

88
export * from './index.bundle.base';
99

10-
export { logger, consoleLoggingIntegration, metrics } from '@sentry/core/browser';
10+
export { logger, consoleLoggingIntegration, metrics } from '@sentry/core';
1111

1212
export { replayIntegration, getReplay } from '@sentry/replay';
1313

0 commit comments

Comments
 (0)