Skip to content

Commit 8f867b7

Browse files
authored
Merge branch 'develop' into timfish/build/exclude-debug-build-side-effects
2 parents 75f8a85 + 0dec883 commit 8f867b7

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

packages/svelte/src/debug_build.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
declare const __DEBUG_BUILD__: boolean;
2+
3+
/**
4+
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
5+
*
6+
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
7+
*/
8+
export const DEBUG_BUILD = __DEBUG_BUILD__;

packages/svelte/src/performance.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';
22
import type { Span } from '@sentry/core';
3-
import { logger, startInactiveSpan } from '@sentry/core';
3+
import { debug, startInactiveSpan } from '@sentry/core';
44
import { afterUpdate, beforeUpdate, onMount } from 'svelte';
5+
import { DEBUG_BUILD } from './debug_build';
56
import type { TrackComponentOptions } from './types';
67

78
const defaultTrackComponentOptions: {
@@ -37,9 +38,10 @@ export function trackComponent(options?: TrackComponentOptions): void {
3738
try {
3839
recordUpdateSpans(componentName);
3940
} catch {
40-
logger.warn(
41-
"Cannot track component updates. This is likely because you're using Svelte 5 in Runes mode. Set `trackUpdates: false` in `withSentryConfig` or `trackComponent` to disable this warning.",
42-
);
41+
DEBUG_BUILD &&
42+
debug.warn(
43+
"Cannot track component updates. This is likely because you're using Svelte 5 in Runes mode. Set `trackUpdates: false` in `withSentryConfig` or `trackComponent` to disable this warning.",
44+
);
4345
}
4446
}
4547
}

packages/vue/src/tracing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/browser';
22
import type { Span } from '@sentry/core';
3-
import { logger, timestampInSeconds } from '@sentry/core';
3+
import { debug, timestampInSeconds } from '@sentry/core';
44
import { DEFAULT_HOOKS } from './constants';
55
import { DEBUG_BUILD } from './debug-build';
66
import type { Hook, Operation, TracingOptions, ViewModel, Vue } from './types';
@@ -73,7 +73,7 @@ export const createTracingMixins = (options: Partial<TracingOptions> = {}): Mixi
7373
// eg. mount => ['beforeMount', 'mounted']
7474
const internalHooks = HOOKS[operation];
7575
if (!internalHooks) {
76-
DEBUG_BUILD && logger.warn(`Unknown hook: ${operation}`);
76+
DEBUG_BUILD && debug.warn(`Unknown hook: ${operation}`);
7777
continue;
7878
}
7979

packages/vue/test/integration/VueIntegration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import type { Client } from '@sentry/core';
6-
import { logger } from '@sentry/core';
6+
import { debug } from '@sentry/core';
77
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
88
import { createApp } from 'vue';
99
import * as Sentry from '../../src';
@@ -35,7 +35,7 @@ describe('Sentry.VueIntegration', () => {
3535
warnings = [];
3636
loggerWarnings = [];
3737

38-
vi.spyOn(logger, 'warn').mockImplementation((message: unknown) => {
38+
vi.spyOn(debug, 'warn').mockImplementation((message: unknown) => {
3939
loggerWarnings.push(message);
4040
});
4141

0 commit comments

Comments
 (0)