|
1 | | -import type { Integration, Options } from '@sentry/types'; |
| 1 | +import type { Client, Integration, Options } from '@sentry/types'; |
2 | 2 | import { arrayify, logger } from '@sentry/utils'; |
3 | 3 |
|
4 | 4 | import { getCurrentHub } from './hub'; |
@@ -84,28 +84,30 @@ export function getIntegrationsToSetup(options: Options): Integration[] { |
84 | 84 | * @param integrations array of integration instances |
85 | 85 | * @param withDefault should enable default integrations |
86 | 86 | */ |
87 | | -export function setupIntegrations(integrations: Integration[]): IntegrationIndex { |
| 87 | +export function setupIntegrations(client: Client, integrations: Integration[]): IntegrationIndex { |
88 | 88 | const integrationIndex: IntegrationIndex = {}; |
89 | 89 |
|
90 | 90 | integrations.forEach(integration => { |
91 | 91 | // guard against empty provided integrations |
92 | 92 | if (integration) { |
93 | | - setupIntegration(integration, integrationIndex); |
| 93 | + setupIntegration(client, integration, integrationIndex); |
94 | 94 | } |
95 | 95 | }); |
96 | 96 |
|
97 | 97 | return integrationIndex; |
98 | 98 | } |
99 | 99 |
|
100 | 100 | /** Setup a single integration. */ |
101 | | -export function setupIntegration(integration: Integration, integrationIndex: IntegrationIndex): void { |
| 101 | +export function setupIntegration(client: Client, integration: Integration, integrationIndex: IntegrationIndex): void { |
102 | 102 | integrationIndex[integration.name] = integration; |
103 | 103 |
|
104 | 104 | if (installedIntegrations.indexOf(integration.name) === -1) { |
105 | 105 | integration.setupOnce(addGlobalEventProcessor, getCurrentHub); |
106 | 106 | installedIntegrations.push(integration.name); |
107 | | - __DEBUG_BUILD__ && logger.log(`Integration installed: ${integration.name}`); |
108 | 107 | } |
| 108 | + |
| 109 | + integration.setup && integration.setup(client); |
| 110 | + __DEBUG_BUILD__ && logger.log(`Integration installed: ${integration.name}`); |
109 | 111 | } |
110 | 112 |
|
111 | 113 | // Polyfill for Array.findIndex(), which is not supported in ES5 |
|
0 commit comments