-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nuxt): Expose
vueIntegration
(#14526)
- Loading branch information
Showing
8 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { GLOBAL_OBJ, defineIntegration } from '@sentry/core'; | ||
import type { VueIntegrationOptions } from '@sentry/vue'; | ||
|
||
type Options = Omit< | ||
VueIntegrationOptions, | ||
| 'app' | ||
| 'Vue' | ||
// TODO(v9): Should be removed from parent type so we can remove it here | ||
| 'hooks' | ||
// TODO(v9): Should be removed from parent type so we can remove it here | ||
| 'timeout' | ||
// TODO(v9): Should be removed from parent type so we can remove it here | ||
| 'trackComponents' | ||
>; | ||
|
||
// Since the options object needs to cross the boundary between some builds (i.e. the nuxt module build and our client | ||
// SDK build) we cannot use a getter that is exported from here. Instead we'll pass the options object through a global | ||
// to the module. | ||
export type GlobalObjWithIntegrationOptions = { _sentryNuxtVueIntegrationOptions?: Options }; | ||
|
||
// The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available. | ||
// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away | ||
// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration. | ||
|
||
/** | ||
* Add additional error and span instrumentation specialized for Vue. | ||
*/ | ||
export const vueIntegration = defineIntegration((options: Options = {}) => { | ||
return { | ||
// NOTE: This name is different from the original vueIntegration's name. | ||
name: 'NuxtVueIntegration', | ||
setup() { | ||
(GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions = options; | ||
}, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters