Skip to content

fix(tracing): Remove circular dep warning in build with GLOBAL #6030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/tracing/src/browser/backgroundtab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { logger } from '@sentry/utils';
import { IdleTransaction } from '../idletransaction';
import { SpanStatusType } from '../span';
import { getActiveTransaction } from '../utils';
import { WINDOW } from '.';
import { WINDOW } from './types';

/**
* Add a listener that cancels and finishes a transaction when the global
Expand Down
2 changes: 1 addition & 1 deletion packages/tracing/src/browser/browsertracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { baggageHeaderToDynamicSamplingContext, getDomElement, logger } from '@s
import { startIdleTransaction } from '../hubextensions';
import { DEFAULT_FINAL_TIMEOUT, DEFAULT_HEARTBEAT_INTERVAL, DEFAULT_IDLE_TIMEOUT } from '../idletransaction';
import { extractTraceparentData } from '../utils';
import { WINDOW } from '.';
import { registerBackgroundTabDetection } from './backgroundtab';
import { addPerformanceEntries, startTrackingLongTasks, startTrackingWebVitals } from './metrics';
import {
Expand All @@ -15,6 +14,7 @@ import {
RequestInstrumentationOptions,
} from './request';
import { instrumentRoutingWithDefaults } from './router';
import { WINDOW } from './types';

export const BROWSER_TRACING_INTEGRATION_ID = 'BrowserTracing';

Expand Down
4 changes: 0 additions & 4 deletions packages/tracing/src/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { GLOBAL_OBJ } from '@sentry/utils';

export type { RequestInstrumentationOptions } from './request';

export { BrowserTracing, BROWSER_TRACING_INTEGRATION_ID } from './browsertracing';
export { instrumentOutgoingRequests, defaultRequestInstrumentationOptions } from './request';

export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
2 changes: 1 addition & 1 deletion packages/tracing/src/browser/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import { Measurements } from '@sentry/types';
import { browserPerformanceTimeOrigin, htmlTreeAsString, logger } from '@sentry/utils';

import { WINDOW } from '..';
import { IdleTransaction } from '../../idletransaction';
import { Transaction } from '../../transaction';
import { getActiveTransaction, msToSec } from '../../utils';
import { WINDOW } from '../types';
import { onCLS } from '../web-vitals/getCLS';
import { onFID } from '../web-vitals/getFID';
import { onLCP } from '../web-vitals/getLCP';
Expand Down
2 changes: 1 addition & 1 deletion packages/tracing/src/browser/router.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Transaction, TransactionContext } from '@sentry/types';
import { addInstrumentationHandler, logger } from '@sentry/utils';

import { WINDOW } from '.';
import { WINDOW } from './types';

/**
* Default function implementing pageload and navigation transactions
Expand Down
3 changes: 3 additions & 0 deletions packages/tracing/src/browser/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { GLOBAL_OBJ } from '@sentry/utils';

export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { WINDOW } from '../..';
import { WINDOW } from '../../types';
import { NavigationTimingPolyfillEntry } from '../types';

const getNavigationEntryFromPerformanceTiming = (): NavigationTimingPolyfillEntry => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { WINDOW } from '../..';
import { WINDOW } from '../../types';
import { onHidden } from './onHidden';

let firstHiddenTime = -1;
Expand Down
2 changes: 1 addition & 1 deletion packages/tracing/src/browser/web-vitals/lib/initMetric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { WINDOW } from '../..';
import { WINDOW } from '../../types';
import { Metric } from '../types';
import { generateUniqueID } from './generateUniqueID';
import { getActivationStart } from './getActivationStart';
Expand Down
2 changes: 1 addition & 1 deletion packages/tracing/src/browser/web-vitals/lib/onHidden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { WINDOW } from '../..';
import { WINDOW } from '../../types';

export interface OnHiddenCallback {
(event: Event): void;
Expand Down