Skip to content

Commit 442ccc7

Browse files
committed
move getMainCarrier to @sentry/utils
1 parent bb69207 commit 442ccc7

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

packages/hub/src/hub.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
TransactionContext,
2323
User,
2424
} from '@sentry/types';
25-
import { consoleSandbox, dateTimestampInSeconds, getGlobalObject, isNodeEnv, logger, uuid4 } from '@sentry/utils';
25+
import { consoleSandbox, dateTimestampInSeconds, getMainCarrier, isNodeEnv, logger, uuid4 } from '@sentry/utils';
2626

2727
import { DomainAsCarrier, Layer } from './interfaces';
2828
import { Scope } from './scope';
@@ -451,16 +451,6 @@ export class Hub implements HubInterface {
451451
}
452452
}
453453

454-
/** Returns the global shim registry. */
455-
export function getMainCarrier(): Carrier {
456-
const carrier = getGlobalObject();
457-
carrier.__SENTRY__ = carrier.__SENTRY__ || {
458-
extensions: {},
459-
hub: undefined,
460-
};
461-
return carrier;
462-
}
463-
464454
/**
465455
* Replaces the current main hub with the passed one on the global object
466456
*

packages/hub/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export {
77
getActiveDomain,
88
getCurrentHub,
99
getHubFromCarrier,
10-
getMainCarrier,
1110
Hub,
1211
makeMain,
1312
setHubOnCarrier,
1413
} from './hub';
1514

1615
// For backwards compatibillity
16+
export { getMainCarrier } from '@sentry/utils';
1717
export { Carrier } from '@sentry/types';

packages/node/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export { defaultIntegrations, init, lastEventId, flush, close } from './sdk';
4444
export { SDK_NAME } from './version';
4545

4646
import { Integrations as CoreIntegrations } from '@sentry/core';
47-
import { getMainCarrier } from '@sentry/hub';
47+
import { getMainCarrier } from '@sentry/utils';
4848
import * as domain from 'domain';
4949

5050
import * as Handlers from './handlers';

packages/node/src/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@sentry/core';
2-
import { getMainCarrier, setHubOnCarrier } from '@sentry/hub';
3-
import { getGlobalObject } from '@sentry/utils';
2+
import { setHubOnCarrier } from '@sentry/hub';
3+
import { getGlobalObject, getMainCarrier } from '@sentry/utils';
44
import * as domain from 'domain';
55

66
import { NodeOptions } from './backend';

packages/tracing/src/hubextensions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { getMainCarrier, Hub } from '@sentry/hub';
1+
import { Hub } from '@sentry/hub';
22
import {
33
CustomSamplingContext,
44
Options,
55
SamplingContext,
66
TransactionContext,
77
TransactionSamplingMethod,
88
} from '@sentry/types';
9-
import { logger } from '@sentry/utils';
9+
import { getMainCarrier, logger } from '@sentry/utils';
1010

1111
import { registerErrorInstrumentation } from './errors';
1212
import { IdleTransaction } from './idletransaction';

packages/utils/src/compat.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,13 @@ export function getGlobalObject<T>(): T & SentryGlobal {
4242
? self
4343
: fallbackGlobalObject) as T & SentryGlobal;
4444
}
45+
46+
/** Returns the global shim registry. */
47+
export function getMainCarrier(): Carrier {
48+
const carrier = getGlobalObject();
49+
carrier.__SENTRY__ = carrier.__SENTRY__ || {
50+
extensions: {},
51+
hub: undefined,
52+
};
53+
return carrier;
54+
}

0 commit comments

Comments
 (0)