Skip to content

Commit 74c1da4

Browse files
committed
feat: migrate to sentry v7
1 parent 07fb5ce commit 74c1da4

File tree

12 files changed

+1386
-2406
lines changed

12 files changed

+1386
-2406
lines changed

docs/content/en/sentry/options.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ Note that the module sets the following defaults when publishing is enabled:
233233
Dedupe: {},
234234
ExtraErrorData: {},
235235
ReportingObserver: {},
236-
RewriteFrames: {},
237-
Vue: {attachProps: true, logErrors: this.options.dev}
236+
RewriteFrames: {}
238237
}
239238
```
240239
- Sentry by default also enables these browser integrations: `InboundFilters`, `FunctionToString`, `TryCatch`, `Breadcrumbs`, `GlobalHandlers`, `LinkedErrors`, `UserAgent`. Their options can be overridden by specifying them manually in the object.
@@ -307,7 +306,7 @@ export default function () {
307306
308307
<alert type="info">
309308
310-
`@sentry/tracing@6` (version 6 and not newer) should be installed manually when using this option.
309+
`@sentry/tracing@7` (version 7 and not newer) should be installed manually when using this option.
311310
312311
</alert>
313312

lib/core/options.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import merge from 'lodash.mergewith'
22
import * as Integrations from '@sentry/integrations'
33
import { canInitialize } from './utils'
44

5-
export const PLUGGABLE_INTEGRATIONS = ['CaptureConsole', 'Debug', 'Dedupe', 'ExtraErrorData', 'ReportingObserver', 'RewriteFrames', 'Vue']
5+
export const PLUGGABLE_INTEGRATIONS = ['CaptureConsole', 'Debug', 'Dedupe', 'ExtraErrorData', 'ReportingObserver', 'RewriteFrames']
66
export const BROWSER_INTEGRATIONS = ['InboundFilters', 'FunctionToString', 'TryCatch', 'Breadcrumbs', 'GlobalHandlers', 'LinkedErrors', 'UserAgent']
77
const SERVER_INTEGRATIONS = ['CaptureConsole', 'Debug', 'Dedupe', 'ExtraErrorData', 'RewriteFrames', 'Modules', 'Transaction']
88

@@ -96,7 +96,6 @@ function resolveTracingOptions (tracing, config) {
9696
/** @type {NonNullable<import('../../types/sentry').TracingConfiguration>} */
9797
const tracingOptions = merge(
9898
{
99-
tracesSampleRate: 1.0,
10099
vueOptions: {
101100
tracing: true,
102101
tracingOptions: {

lib/module.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default function SentryModule (moduleOptions) {
3535
ExtraErrorData: {},
3636
ReportingObserver: {},
3737
RewriteFrames: {},
38-
Vue: { attachProps: true, logErrors: this.options.dev },
3938
},
4039
serverIntegrations: {
4140
Dedupe: {},

lib/plugin.client.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import VueLib from 'vue'
1+
import Vue from 'vue'
22
import merge from 'lodash.mergewith'
3-
import * as Sentry from '@sentry/browser'
3+
import * as Sentry from '@sentry/vue'
44
<%
55
if (options.initialize) {
66
let integrations = options.PLUGGABLE_INTEGRATIONS.filter(key => key in options.integrations)
@@ -15,14 +15,15 @@ const { <%= integrations.join(', ') %> } = Sentry.Integrations
1515
}
1616
%>
1717
<% if (options.tracing) { %>
18-
import { Integrations as TracingIntegrations } from '@sentry/tracing'
18+
import { BrowserTracing } from "@sentry/tracing";
1919
<% } %>
2020

2121
// eslint-disable-next-line require-await
2222
export default async function (ctx, inject) {
2323
<% if (options.initialize) { %>
2424
/* eslint-disable object-curly-spacing, quote-props, quotes, key-spacing, comma-spacing */
2525
const config = {
26+
Vue,
2627
<%= Object.entries(options.config).map(([key, option]) =>
2728
typeof option === 'function'
2829
? `${key}:${serializeFunction(option)}`
@@ -37,13 +38,6 @@ export default async function (ctx, inject) {
3738

3839
config.integrations = [
3940
<%= Object.entries(options.integrations).map(([name, integration]) => {
40-
if (name === 'Vue') {
41-
if (options.tracing) {
42-
integration = { ...integration, ...options.tracing.vueOptions }
43-
}
44-
return `new ${name}({ Vue: VueLib, ...${serialize(integration)}})`
45-
}
46-
4741
const integrationOptions = Object.entries(integration).map(([key, option]) =>
4842
typeof option === 'function'
4943
? `${key}:${serializeFunction(option)}`
@@ -54,7 +48,7 @@ export default async function (ctx, inject) {
5448
}).join(',\n ')%>,
5549
]
5650
<% if (options.tracing) { %>
57-
config.integrations.push(<%= `new TracingIntegrations.BrowserTracing(${serialize(options.tracing.browserOptions)})` %>)
51+
config.integrations.push(<%= `new BrowserTracing(${serialize(options.tracing.browserOptions)})` %>)
5852
<% } %>
5953
<% if (options.customClientIntegrations) { %>
6054
const customIntegrations = await getCustomIntegrations(ctx)

lib/plugin.lazy.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async function loadSentry (ctx, inject) {
110110
magicComments.push('webpackPreload: true')
111111
}
112112
%>
113-
const Sentry = await import(/* <%= magicComments.join(', ') %> */ '@sentry/browser')
113+
const Sentry = await import(/* <%= magicComments.join(', ') %> */ '@sentry/vue')
114114
<%
115115
if (options.initialize) {
116116
let integrations = options.PLUGGABLE_INTEGRATIONS.filter(key => key in options.integrations)
@@ -122,6 +122,7 @@ async function loadSentry (ctx, inject) {
122122
%>
123123
/* eslint-disable object-curly-spacing, quote-props, quotes, key-spacing, comma-spacing */
124124
const config = <%= serialize(options.config) %>
125+
config.Vue = VueLib
125126

126127
const runtimeConfigKey = <%= serialize(options.runtimeConfigKey) %>
127128
if (ctx.$config && runtimeConfigKey && ctx.$config[runtimeConfigKey]) {
@@ -131,10 +132,6 @@ async function loadSentry (ctx, inject) {
131132

132133
config.integrations = [
133134
<%= Object.entries(options.integrations).map(([name, integration]) => {
134-
if (name === 'Vue') {
135-
return `new ${name}({ Vue: VueLib, ...${serialize(integration)}})`
136-
}
137-
138135
const integrationOptions = Object.entries(integration).map(([key, option]) =>
139136
typeof option === 'function'
140137
? `${key}:${serializeFunction(option)}`

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
}
5151
},
5252
"dependencies": {
53-
"@sentry/browser": "^6.19.7",
54-
"@sentry/integrations": "^6.19.7",
55-
"@sentry/node": "^6.19.7",
53+
"@sentry/integrations": "^7.23.0",
54+
"@sentry/node": "^7.23.0",
55+
"@sentry/vue": "^7.23.0",
5656
"consola": "^2.15.3",
5757
"lodash.mergewith": "^4.6.2"
5858
},
@@ -63,7 +63,7 @@
6363
"@nuxtjs/eslint-config-typescript": "^11.0.0",
6464
"@nuxtjs/module-test-utils": "^1.6.3",
6565
"@release-it/conventional-changelog": "^5.1.0",
66-
"@sentry/tracing": "^6.19.7",
66+
"@sentry/tracing": "^7.23.0",
6767
"@sentry/webpack-plugin": "^1.19.0",
6868
"@types/jest": "^29.0.3",
6969
"@types/lodash.mergewith": "^4.6.7",
@@ -80,6 +80,7 @@
8080
"playwright-chromium": "^1.26.1",
8181
"release-it": "^15.4.2",
8282
"sentry-testkit": "^4.0.3",
83-
"typescript": "^4.8.4"
83+
"typescript": "^4.8.4",
84+
"vue": "2.7.14"
8485
}
8586
}

test/fixture/default/pages/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
export default {
1212
data () {
1313
return {
14-
/** @type {import('@sentry/minimal') | null} */
14+
/** @type {import('@sentry/core') | null} */
1515
clientSentry: null,
16-
/** @type {import('@sentry/minimal') | null} */
16+
/** @type {import('@sentry/core') | null} */
1717
serverSentry: this.$sentry,
1818
}
1919
},

test/fixture/lazy/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
data () {
1313
return {
1414
isSentryReady: false,
15-
/** @type {import('@sentry/minimal') | null} */
15+
/** @type {import('@sentry/core') | null} */
1616
serverSentry: this.$sentry,
1717
}
1818
},

test/fixture/with-lazy-config/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
data () {
1313
return {
1414
isSentryReady: false,
15-
/** @type {import('@sentry/minimal') | null} */
15+
/** @type {import('@sentry/core') | null} */
1616
serverSentry: this.$sentry,
1717
}
1818
},

test/fixture/with-lazy-config/pages/mounted.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
data () {
1313
return {
1414
isSentryReady: false,
15-
/** @type {import('@sentry/minimal') | null} */
15+
/** @type {import('@sentry/core') | null} */
1616
serverSentry: this.$sentry,
1717
}
1818
},

0 commit comments

Comments
 (0)