@sentry/nuxt 8.36.0-alpha.0 → 8.36.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -75,7 +75,7 @@ Sentry.init({
75
75
 
76
76
  ### 4. Server-side setup
77
77
 
78
- Add an `sentry.client.config.ts` file to the root of your project:
78
+ Add a `sentry.server.config.ts` file to the root of your project:
79
79
 
80
80
  ```javascript
81
81
  import * as Sentry from '@sentry/nuxt';
@@ -137,16 +137,28 @@ When adding `sentry.server.config.ts`, you might get an error like this:
137
137
  for `@vercel/nft` to fix this. This will add the `hook.mjs` file to your build output
138
138
  ([Nitro issue here](https://github.com/unjs/nitro/issues/2703)).
139
139
 
140
+ For `npm`:
141
+
140
142
  ```json
141
143
  "overrides": {
142
144
  "@vercel/nft": "^0.27.4"
143
145
  }
144
146
  ```
145
147
 
146
- or in `yarn`:
148
+ for `yarn`:
147
149
 
148
150
  ```json
149
151
  "resolutions": {
150
152
  "@vercel/nft": "^0.27.4"
151
153
  }
152
154
  ```
155
+
156
+ or for `pnpm`:
157
+
158
+ ```json
159
+ "pnpm": {
160
+ "overrides": {
161
+ "@vercel/nft": "^0.27.4"
162
+ }
163
+ }
164
+ ```
@@ -1,7 +1,8 @@
1
1
  const core = require('@sentry/core');
2
+ const utils = require('@sentry/utils');
2
3
  const vue = require('@sentry/vue');
3
4
  const app = require('nuxt/app');
4
- const utils = require('../utils.js');
5
+ const utils$1 = require('../utils.js');
5
6
 
6
7
  // --- Types are copied from @sentry/vue (so it does not need to be exported) ---
7
8
  // The following type is an intersection of the Route type from VueRouter v2, v3, and v4.
@@ -11,11 +12,12 @@ const sentry_client = app.defineNuxtPlugin({
11
12
  name: 'sentry-client-integrations',
12
13
  dependsOn: ['sentry-client-config'],
13
14
  async setup(nuxtApp) {
15
+ const sentryClient = core.getClient();
16
+ const clientOptions = sentryClient && sentryClient.getOptions();
17
+
14
18
  // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", in which case everything inside
15
19
  // will get tree-shaken away
16
20
  if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
17
- const sentryClient = core.getClient();
18
-
19
21
  if (sentryClient && '$router' in nuxtApp) {
20
22
  sentryClient.addIntegration(
21
23
  vue.browserTracingIntegration({ router: nuxtApp.$router , routeLabel: 'path' }),
@@ -23,6 +25,23 @@ const sentry_client = app.defineNuxtPlugin({
23
25
  }
24
26
  }
25
27
 
28
+ if (clientOptions && 'trackPinia' in clientOptions && clientOptions.trackPinia) {
29
+ if ('$pinia' in nuxtApp) {
30
+ (nuxtApp.$pinia ).use(
31
+ // `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options)
32
+ vue.createSentryPiniaPlugin(clientOptions.trackPinia === true ? undefined : clientOptions.trackPinia),
33
+ );
34
+ } else {
35
+ clientOptions.debug &&
36
+ utils.consoleSandbox(() => {
37
+ // eslint-disable-next-line no-console
38
+ console.warn(
39
+ '[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `"@pinia/nuxt"` to your modules array.',
40
+ );
41
+ });
42
+ }
43
+ }
44
+
26
45
  nuxtApp.hook('app:created', vueApp => {
27
46
  const sentryClient = core.getClient();
28
47
 
@@ -35,11 +54,11 @@ const sentry_client = app.defineNuxtPlugin({
35
54
  });
36
55
 
37
56
  nuxtApp.hook('app:error', error => {
38
- utils.reportNuxtError({ error });
57
+ utils$1.reportNuxtError({ error });
39
58
  });
40
59
 
41
60
  nuxtApp.hook('vue:error', (error, instance, info) => {
42
- utils.reportNuxtError({ error, instance, info });
61
+ utils$1.reportNuxtError({ error, instance, info });
43
62
  });
44
63
  },
45
64
  });
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { browserTracingIntegration, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\nimport { reportNuxtError } from '../utils';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n const sentryClient = getClient();\n\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n // Adding the Vue integration without the Vue error handler\n // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73\n // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));\n }\n });\n\n nuxtApp.hook('app:error', error => {\n reportNuxtError({ error });\n });\n\n nuxtApp.hook('vue:error', (error, instance, info) => {\n reportNuxtError({ error, instance, info });\n });\n },\n});\n"],"names":["defineNuxtPlugin","getClient","browserTracingIntegration","vueIntegration","reportNuxtError"],"mappings":";;;;;AAKA;AACA;AACA;;AAyBA,sBAAeA,oBAAgB,CAAC;AAChC,EAAE,IAAI,EAAE,4BAA4B;AACpC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC;AACrC,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE;AACvB;AACA;AACA,IAAI,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACzE,MAAM,MAAM,YAAA,GAAeC,cAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAA,IAAgB,SAAU,IAAG,OAAO,EAAE;AAChD,QAAQ,YAAY,CAAC,cAAc;AACnC,UAAUC,6BAAyB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAA,GAAsB,UAAU,EAAE,MAAA,EAAQ,CAAC;AACjG,SAAS,CAAA;AACT,OAAM;AACN,KAAI;AACJ;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU;AAC1C,MAAM,MAAM,YAAA,GAAeD,cAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAY,EAAE;AACxB;AACA;AACA;AACA,QAAQ,YAAY,CAAC,cAAc,CAACE,kBAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAM,EAAC,CAAC,CAAC,CAAA;AAC/F,OAAM;AACN,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS;AACvC,MAAMC,qBAAe,CAAC,EAAE,KAAA,EAAO,CAAC,CAAA;AAChC,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,KAAK;AACzD,MAAMA,qBAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAK,EAAC,CAAC,CAAA;AAChD,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { consoleSandbox } from '@sentry/utils';\nimport { browserTracingIntegration, createSentryPiniaPlugin, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\nimport { reportNuxtError } from '../utils';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n const sentryClient = getClient();\n const clientOptions = sentryClient && sentryClient.getOptions();\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n if (clientOptions && 'trackPinia' in clientOptions && clientOptions.trackPinia) {\n if ('$pinia' in nuxtApp) {\n (nuxtApp.$pinia as { use: (plugin: unknown) => void }).use(\n // `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options)\n createSentryPiniaPlugin(clientOptions.trackPinia === true ? undefined : clientOptions.trackPinia),\n );\n } else {\n clientOptions.debug &&\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `\"@pinia/nuxt\"` to your modules array.',\n );\n });\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n // Adding the Vue integration without the Vue error handler\n // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73\n // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));\n }\n });\n\n nuxtApp.hook('app:error', error => {\n reportNuxtError({ error });\n });\n\n nuxtApp.hook('vue:error', (error, instance, info) => {\n reportNuxtError({ error, instance, info });\n });\n },\n});\n"],"names":["defineNuxtPlugin","getClient","browserTracingIntegration","createSentryPiniaPlugin","consoleSandbox","vueIntegration","reportNuxtError"],"mappings":";;;;;;AAMA;AACA;AACA;;AAyBA,sBAAeA,oBAAgB,CAAC;AAChC,EAAE,IAAI,EAAE,4BAA4B;AACpC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC;AACrC,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE;AACvB,IAAI,MAAM,YAAA,GAAeC,cAAS,EAAE,CAAA;AACpC,IAAI,MAAM,gBAAgB,YAAA,IAAgB,YAAY,CAAC,UAAU,EAAE,CAAA;AACnE;AACA;AACA;AACA,IAAI,IAAI,OAAO,k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AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,KAAK;AACzD,MAAMA,uBAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAK,EAAC,CAAC,CAAA;AAChD,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"8.36.0-alpha.0"}
1
+ {"type":"module","version":"8.36.0-beta.0"}
@@ -1,5 +1,6 @@
1
1
  import { getClient } from '@sentry/core';
2
- import { browserTracingIntegration, vueIntegration } from '@sentry/vue';
2
+ import { consoleSandbox } from '@sentry/utils';
3
+ import { browserTracingIntegration, createSentryPiniaPlugin, vueIntegration } from '@sentry/vue';
3
4
  import { defineNuxtPlugin } from 'nuxt/app';
4
5
  import { reportNuxtError } from '../utils.js';
5
6
 
@@ -11,11 +12,12 @@ const sentry_client = defineNuxtPlugin({
11
12
  name: 'sentry-client-integrations',
12
13
  dependsOn: ['sentry-client-config'],
13
14
  async setup(nuxtApp) {
15
+ const sentryClient = getClient();
16
+ const clientOptions = sentryClient && sentryClient.getOptions();
17
+
14
18
  // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", in which case everything inside
15
19
  // will get tree-shaken away
16
20
  if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
17
- const sentryClient = getClient();
18
-
19
21
  if (sentryClient && '$router' in nuxtApp) {
20
22
  sentryClient.addIntegration(
21
23
  browserTracingIntegration({ router: nuxtApp.$router , routeLabel: 'path' }),
@@ -23,6 +25,23 @@ const sentry_client = defineNuxtPlugin({
23
25
  }
24
26
  }
25
27
 
28
+ if (clientOptions && 'trackPinia' in clientOptions && clientOptions.trackPinia) {
29
+ if ('$pinia' in nuxtApp) {
30
+ (nuxtApp.$pinia ).use(
31
+ // `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options)
32
+ createSentryPiniaPlugin(clientOptions.trackPinia === true ? undefined : clientOptions.trackPinia),
33
+ );
34
+ } else {
35
+ clientOptions.debug &&
36
+ consoleSandbox(() => {
37
+ // eslint-disable-next-line no-console
38
+ console.warn(
39
+ '[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `"@pinia/nuxt"` to your modules array.',
40
+ );
41
+ });
42
+ }
43
+ }
44
+
26
45
  nuxtApp.hook('app:created', vueApp => {
27
46
  const sentryClient = getClient();
28
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { browserTracingIntegration, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\nimport { reportNuxtError } from '../utils';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n const sentryClient = getClient();\n\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n // Adding the Vue integration without the Vue error handler\n // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73\n // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));\n }\n });\n\n nuxtApp.hook('app:error', error => {\n reportNuxtError({ error });\n });\n\n nuxtApp.hook('vue:error', (error, instance, info) => {\n reportNuxtError({ error, instance, info });\n });\n },\n});\n"],"names":[],"mappings":";;;;;AAKA;AACA;AACA;;AAyBA,sBAAe,gBAAgB,CAAC;AAChC,EAAE,IAAI,EAAE,4BAA4B;AACpC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC;AACrC,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE;AACvB;AACA;AACA,IAAI,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACzE,MAAM,MAAM,YAAA,GAAe,SAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAA,IAAgB,SAAU,IAAG,OAAO,EAAE;AAChD,QAAQ,YAAY,CAAC,cAAc;AACnC,UAAU,yBAAyB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAA,GAAsB,UAAU,EAAE,MAAA,EAAQ,CAAC;AACjG,SAAS,CAAA;AACT,OAAM;AACN,KAAI;AACJ;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU;AAC1C,MAAM,MAAM,YAAA,GAAe,SAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAY,EAAE;AACxB;AACA;AACA;AACA,QAAQ,YAAY,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAM,EAAC,CAAC,CAAC,CAAA;AAC/F,OAAM;AACN,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS;AACvC,MAAM,eAAe,CAAC,EAAE,KAAA,EAAO,CAAC,CAAA;AAChC,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,KAAK;AACzD,MAAM,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAK,EAAC,CAAC,CAAA;AAChD,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { consoleSandbox } from '@sentry/utils';\nimport { browserTracingIntegration, createSentryPiniaPlugin, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\nimport { reportNuxtError } from '../utils';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n const sentryClient = getClient();\n const clientOptions = sentryClient && sentryClient.getOptions();\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n if (clientOptions && 'trackPinia' in clientOptions && clientOptions.trackPinia) {\n if ('$pinia' in nuxtApp) {\n (nuxtApp.$pinia as { use: (plugin: unknown) => void }).use(\n // `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options)\n createSentryPiniaPlugin(clientOptions.trackPinia === true ? undefined : clientOptions.trackPinia),\n );\n } else {\n clientOptions.debug &&\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `\"@pinia/nuxt\"` to your modules array.',\n );\n });\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n // Adding the Vue integration without the Vue error handler\n // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73\n // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));\n }\n });\n\n nuxtApp.hook('app:error', error => {\n reportNuxtError({ error });\n });\n\n nuxtApp.hook('vue:error', (error, instance, info) => {\n reportNuxtError({ error, instance, info });\n });\n },\n});\n"],"names":[],"mappings":";;;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;AACxB;AACA;AACA;AACA,QAAQ,YAAY,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAM,EAAC,CAAC,CAAC,CAAA;AAC/F,OAAM;AACN,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS;AACvC,MAAM,eAAe,CAAC,EAAE,KAAA,EAAO,CAAC,CAAA;AAChC,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,KAAK;AACzD,MAAM,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAK,EAAC,CAAC,CAAA;AAChD,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "8.36.0-alpha.0",
7
+ "version": "8.36.0-beta.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -1,23 +1,39 @@
1
1
  import { getClient } from "@sentry/core";
2
- import { browserTracingIntegration, vueIntegration } from "@sentry/vue";
2
+ import { consoleSandbox } from "@sentry/utils";
3
+ import { browserTracingIntegration, createSentryPiniaPlugin, vueIntegration } from "@sentry/vue";
3
4
  import { defineNuxtPlugin } from "nuxt/app";
4
5
  import { reportNuxtError } from "../utils.js";
5
6
  export default defineNuxtPlugin({
6
7
  name: "sentry-client-integrations",
7
8
  dependsOn: ["sentry-client-config"],
8
9
  async setup(nuxtApp) {
10
+ const sentryClient = getClient();
11
+ const clientOptions = sentryClient && sentryClient.getOptions();
9
12
  if (typeof __SENTRY_TRACING__ === "undefined" || __SENTRY_TRACING__) {
10
- const sentryClient = getClient();
11
13
  if (sentryClient && "$router" in nuxtApp) {
12
14
  sentryClient.addIntegration(
13
15
  browserTracingIntegration({ router: nuxtApp.$router, routeLabel: "path" })
14
16
  );
15
17
  }
16
18
  }
19
+ if (clientOptions && "trackPinia" in clientOptions && clientOptions.trackPinia) {
20
+ if ("$pinia" in nuxtApp) {
21
+ nuxtApp.$pinia.use(
22
+ // `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options)
23
+ createSentryPiniaPlugin(clientOptions.trackPinia === true ? void 0 : clientOptions.trackPinia)
24
+ );
25
+ } else {
26
+ clientOptions.debug && consoleSandbox(() => {
27
+ console.warn(
28
+ '[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `"@pinia/nuxt"` to your modules array.'
29
+ );
30
+ });
31
+ }
32
+ }
17
33
  nuxtApp.hook("app:created", (vueApp) => {
18
- const sentryClient = getClient();
19
- if (sentryClient) {
20
- sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));
34
+ const sentryClient2 = getClient();
35
+ if (sentryClient2) {
36
+ sentryClient2.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));
21
37
  }
22
38
  });
23
39
  nuxtApp.hook("app:error", (error) => {
@@ -1,8 +1,18 @@
1
1
  import type { init as initNode } from '@sentry/node';
2
2
  import type { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
3
3
  import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
4
- import type { init as initVue } from '@sentry/vue';
5
- export type SentryNuxtClientOptions = Omit<Parameters<typeof initVue>[0] & object, 'app'>;
4
+ import type { createSentryPiniaPlugin, init as initVue } from '@sentry/vue';
5
+ export type SentryNuxtClientOptions = Omit<Parameters<typeof initVue>[0] & object, 'app'> & {
6
+ /**
7
+ * Control if an existing Pinia store should be monitored.
8
+ * Set this to `true` to track with default options or provide your custom Pinia plugin options.
9
+ *
10
+ * This only works if "@pinia/nuxt" is added to the `modules` array.
11
+ *
12
+ * @default false
13
+ */
14
+ trackPinia?: true | Parameters<typeof createSentryPiniaPlugin>[0];
15
+ };
6
16
  export type SentryNuxtServerOptions = Omit<Parameters<typeof initNode>[0] & object, 'app'>;
7
17
  type SourceMapsOptions = {
8
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAC1F,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAE3F,KAAK,iBAAiB,GAAG;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;;;;;;;;WASG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,KAAK,CAA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EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;;;;;;;;WASG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KACnD,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,iBAAiB,CAAC;IAE5C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;;;;;;;;;OAYG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC;;;;;OAKG;IACH,mCAAmC,CAAC,EAAE,yBAAyB,GAAG,uBAAuB,CAAC;CAC3F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";AAgCA,wBAmCG"}
1
+ {"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";AAiCA,wBAqDG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "8.36.0-alpha.0",
3
+ "version": "8.36.0-beta.0",
4
4
  "description": "Official Sentry SDK for Nuxt (EXPERIMENTAL)",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@nuxt/kit": "^3.13.2",
46
- "@sentry/browser": "8.36.0-alpha.0",
47
- "@sentry/core": "8.36.0-alpha.0",
48
- "@sentry/node": "8.36.0-alpha.0",
49
- "@sentry/opentelemetry": "8.36.0-alpha.0",
50
- "@sentry/rollup-plugin": "2.22.3",
51
- "@sentry/types": "8.36.0-alpha.0",
52
- "@sentry/utils": "8.36.0-alpha.0",
53
- "@sentry/vite-plugin": "2.22.3",
54
- "@sentry/vue": "8.36.0-alpha.0"
46
+ "@sentry/browser": "8.36.0-beta.0",
47
+ "@sentry/core": "8.36.0-beta.0",
48
+ "@sentry/node": "8.36.0-beta.0",
49
+ "@sentry/opentelemetry": "8.36.0-beta.0",
50
+ "@sentry/rollup-plugin": "2.22.6",
51
+ "@sentry/types": "8.36.0-beta.0",
52
+ "@sentry/utils": "8.36.0-beta.0",
53
+ "@sentry/vite-plugin": "2.22.6",
54
+ "@sentry/vue": "8.36.0-beta.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@nuxt/module-builder": "^0.8.4",