@sentry/nuxt 8.26.0 → 8.28.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 +3 -3
- package/build/cjs/module.js +12 -4
- package/build/cjs/module.js.map +1 -1
- package/build/cjs/runtime/plugins/sentry.client.js +20 -16
- package/build/cjs/runtime/plugins/sentry.client.js.map +1 -1
- package/build/esm/module.js +12 -4
- package/build/esm/module.js.map +1 -1
- package/build/esm/runtime/plugins/sentry.client.js +20 -16
- package/build/esm/runtime/plugins/sentry.client.js.map +1 -1
- package/build/module/module.json +1 -1
- package/build/module/module.mjs +11 -3
- package/build/module/runtime/plugins/sentry.client.js +17 -13
- package/build/types/module.d.ts.map +1 -1
- package/build/types/runtime/plugins/sentry.client.d.ts.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ Add a `sentry.client.config.(js|ts)` file to the root of your project:
|
|
|
96
96
|
import * as Sentry from '@sentry/nuxt';
|
|
97
97
|
|
|
98
98
|
Sentry.init({
|
|
99
|
-
dsn: env.
|
|
99
|
+
dsn: process.env.SENTRY_DSN,
|
|
100
100
|
});
|
|
101
101
|
```
|
|
102
102
|
|
|
@@ -107,10 +107,10 @@ Add an `instrument.server.mjs` file to your `public` folder:
|
|
|
107
107
|
```javascript
|
|
108
108
|
import * as Sentry from '@sentry/nuxt';
|
|
109
109
|
|
|
110
|
-
// Only run `init` when
|
|
110
|
+
// Only run `init` when process.env.SENTRY_DSN is available.
|
|
111
111
|
if (process.env.SENTRY_DSN) {
|
|
112
112
|
Sentry.init({
|
|
113
|
-
dsn: process.env.
|
|
113
|
+
dsn: process.env.SENTRY_DSN,
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
```
|
package/build/cjs/module.js
CHANGED
|
@@ -24,10 +24,18 @@ const module$1 = kit.defineNuxtModule({
|
|
|
24
24
|
kit.addPluginTemplate({
|
|
25
25
|
mode: 'client',
|
|
26
26
|
filename: 'sentry-client-config.mjs',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
|
|
28
|
+
// Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)
|
|
29
|
+
// Makes it possible to call useRuntimeConfig() in the user-defined sentry config file
|
|
30
|
+
getContents: () => `
|
|
31
|
+
import { defineNuxtPlugin } from "#imports";
|
|
32
|
+
|
|
33
|
+
export default defineNuxtPlugin({
|
|
34
|
+
name: 'sentry-client-config',
|
|
35
|
+
async setup() {
|
|
36
|
+
await import("${buildDirResolver.resolve(`/${clientConfigFile}`)}")
|
|
37
|
+
}
|
|
38
|
+
});`,
|
|
31
39
|
});
|
|
32
40
|
|
|
33
41
|
kit.addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'), mode: 'client' });
|
package/build/cjs/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { addPlugin, addPluginTemplate, addServerPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { setupSourceMaps } from './vite/sourceMaps';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '^3.0.0',\n },\n },\n defaults: {},\n setup(moduleOptions, nuxt) {\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client');\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { addPlugin, addPluginTemplate, addServerPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { setupSourceMaps } from './vite/sourceMaps';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '^3.0.0',\n },\n },\n defaults: {},\n setup(moduleOptions, nuxt) {\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client');\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'), mode: 'client' });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server');\n\n if (serverConfigFile) {\n // Inject the server-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'server',\n filename: 'sentry-server-config.mjs',\n getContents: () =>\n `import \"${buildDirResolver.resolve(`/${serverConfigFile}`)}\"\\n` +\n 'import { defineNuxtPlugin } from \"#imports\"\\n' +\n 'export default defineNuxtPlugin(() => {})',\n });\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n },\n});\n\nfunction findDefaultSdkInitFile(type: 'server' | 'client'): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n\n const cwd = process.cwd();\n const filePath = possibleFileExtensions\n .map(e =>\n path.resolve(\n type === 'server'\n ? path.join(cwd, 'public', `instrument.${type}.${e}`)\n : path.join(cwd, `sentry.${type}.config.${e}`),\n ),\n )\n .find(filename => fs.existsSync(filename));\n\n return filePath ? path.basename(filePath) : undefined;\n}\n"],"names":["defineNuxtModule","createResolver","addPluginTemplate","addPlugin","addServerPlugin","setupSourceMaps"],"mappings":";;;;;;AAQA,iBAAeA,oBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,QAAQ;AACpB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE;AAC7B,IAAI,MAAM,iBAAkB,GAAEC,kBAAc,CAAC,8LAAe,CAAC,CAAA;AAC7D,IAAI,MAAM,gBAAiB,GAAEA,kBAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AAClE;AACA,IAAI,MAAM,gBAAiB,GAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAA;AAC7D;AACA,IAAI,IAAI,gBAAgB,EAAE;AAC1B;AACA,MAAMC,qBAAiB,CAAC;AACxB,QAAQ,IAAI,EAAE,QAAQ;AACtB,QAAQ,QAAQ,EAAE,0BAA0B;AAC5C;AACA;AACA;AACA,QAAQ,WAAW,EAAE,MAAM,CAAC;AAC5B;AACA;AACA;AACA;AACA;AACA,4BAA4B,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAA,CAAA,CAAA;AACA;AACA,aAAA,CAAA;AACA,OAAA,CAAA,CAAA;AACA;AACA,MAAAC,aAAA,CAAA,EAAA,GAAA,EAAA,iBAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EA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,CAAA,CAAA,CAAA,CAAA;AACA,OAAA;AACA,KAAA;AACA,KAAA,IAAA,CAAA,QAAA,IAAA,EAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CAAA,CAAA;AACA;AACA,EAAA,OAAA,QAAA,GAAA,IAAA,CAAA,QAAA,CAAA,QAAA,CAAA,GAAA,SAAA,CAAA;AACA;;;;"}
|
|
@@ -6,26 +6,30 @@ const app = require('nuxt/app');
|
|
|
6
6
|
// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.
|
|
7
7
|
// This is not great, but kinda necessary to make it work with all versions at the same time.
|
|
8
8
|
|
|
9
|
-
const sentry_client = app.defineNuxtPlugin(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const sentry_client = app.defineNuxtPlugin({
|
|
10
|
+
name: 'sentry-client-integrations',
|
|
11
|
+
dependsOn: ['sentry-client-config'],
|
|
12
|
+
async setup(nuxtApp) {
|
|
13
|
+
// This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", in which case everything inside
|
|
14
|
+
// will get tree-shaken away
|
|
15
|
+
if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
|
|
16
|
+
const sentryClient = core.getClient();
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
if (sentryClient && '$router' in nuxtApp) {
|
|
19
|
+
sentryClient.addIntegration(
|
|
20
|
+
vue.browserTracingIntegration({ router: nuxtApp.$router , routeLabel: 'path' }),
|
|
21
|
+
);
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
|
-
}
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
nuxtApp.hook('app:created', vueApp => {
|
|
26
|
+
const sentryClient = core.getClient();
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
if (sentryClient) {
|
|
29
|
+
sentryClient.addIntegration(vue.vueIntegration({ app: vueApp }));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
29
33
|
});
|
|
30
34
|
|
|
31
35
|
module.exports = sentry_client;
|
|
@@ -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';\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(nuxtApp
|
|
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';\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 sentryClient.addIntegration(vueIntegration({ app: vueApp }));\n }\n });\n },\n});\n"],"names":["defineNuxtPlugin","getClient","browserTracingIntegration","vueIntegration"],"mappings":";;;;AAIA;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,QAAQ,YAAY,CAAC,cAAc,CAACE,kBAAc,CAAC,EAAE,GAAG,EAAE,MAAA,EAAQ,CAAC,CAAC,CAAA;AACpE,OAAM;AACN,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
|
package/build/esm/module.js
CHANGED
|
@@ -23,10 +23,18 @@ const module = defineNuxtModule({
|
|
|
23
23
|
addPluginTemplate({
|
|
24
24
|
mode: 'client',
|
|
25
25
|
filename: 'sentry-client-config.mjs',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
|
|
27
|
+
// Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)
|
|
28
|
+
// Makes it possible to call useRuntimeConfig() in the user-defined sentry config file
|
|
29
|
+
getContents: () => `
|
|
30
|
+
import { defineNuxtPlugin } from "#imports";
|
|
31
|
+
|
|
32
|
+
export default defineNuxtPlugin({
|
|
33
|
+
name: 'sentry-client-config',
|
|
34
|
+
async setup() {
|
|
35
|
+
await import("${buildDirResolver.resolve(`/${clientConfigFile}`)}")
|
|
36
|
+
}
|
|
37
|
+
});`,
|
|
30
38
|
});
|
|
31
39
|
|
|
32
40
|
addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'), mode: 'client' });
|
package/build/esm/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { addPlugin, addPluginTemplate, addServerPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { setupSourceMaps } from './vite/sourceMaps';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '^3.0.0',\n },\n },\n defaults: {},\n setup(moduleOptions, nuxt) {\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client');\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { addPlugin, addPluginTemplate, addServerPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { setupSourceMaps } from './vite/sourceMaps';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '^3.0.0',\n },\n },\n defaults: {},\n setup(moduleOptions, nuxt) {\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client');\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'), mode: 'client' });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server');\n\n if (serverConfigFile) {\n // Inject the server-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'server',\n filename: 'sentry-server-config.mjs',\n getContents: () =>\n `import \"${buildDirResolver.resolve(`/${serverConfigFile}`)}\"\\n` +\n 'import { defineNuxtPlugin } from \"#imports\"\\n' +\n 'export default defineNuxtPlugin(() => {})',\n });\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n },\n});\n\nfunction findDefaultSdkInitFile(type: 'server' | 'client'): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n\n const cwd = process.cwd();\n const filePath = possibleFileExtensions\n .map(e =>\n path.resolve(\n type === 'server'\n ? path.join(cwd, 'public', `instrument.${type}.${e}`)\n : path.join(cwd, `sentry.${type}.config.${e}`),\n ),\n )\n .find(filename => fs.existsSync(filename));\n\n return filePath ? path.basename(filePath) : undefined;\n}\n"],"names":[],"mappings":";;;;;AAQA,eAAe,gBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,QAAQ;AACpB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE;AAC7B,IAAI,MAAM,iBAAkB,GAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC7D,IAAI,MAAM,gBAAiB,GAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,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A;AACA,EAAA,MAAA,sBAAA,GAAA,CAAA,IAAA,EAAA,IAAA,EAAA,KAAA,EAAA,KAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACA;AACA,EAAA,MAAA,GAAA,GAAA,OAAA,CAAA,GAAA,EAAA,CAAA;AACA,EAAA,MAAA,QAAA,GAAA,sBAAA;AACA,KAAA,GAAA,CAAA,CAAA;AACA,MAAA,IAAA,CAAA,OAAA;AACA,QAAA,IAAA,KAAA,QAAA;AACA,YAAA,IAAA,CAAA,IAAA,CAAA,GAAA,EAAA,QAAA,EAAA,CAAA,WAAA,EAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AACA,YAAA,IAAA,CAAA,IAAA,CAAA,GAAA,EAAA,CAAA,OAAA,EAAA,IAAA,CAAA,QAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AACA,OAAA;AACA,KAAA;AACA,KAAA,IAAA,CAAA,QAAA,IAAA,EAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CAAA,CAAA;AACA;AACA,EAAA,OAAA,QAAA,GAAA,IAAA,CAAA,QAAA,CAAA,QAAA,CAAA,GAAA,SAAA,CAAA;AACA;;;;"}
|
|
@@ -6,26 +6,30 @@ import { defineNuxtPlugin } from 'nuxt/app';
|
|
|
6
6
|
// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.
|
|
7
7
|
// This is not great, but kinda necessary to make it work with all versions at the same time.
|
|
8
8
|
|
|
9
|
-
const sentry_client = defineNuxtPlugin(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const sentry_client = defineNuxtPlugin({
|
|
10
|
+
name: 'sentry-client-integrations',
|
|
11
|
+
dependsOn: ['sentry-client-config'],
|
|
12
|
+
async setup(nuxtApp) {
|
|
13
|
+
// This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", in which case everything inside
|
|
14
|
+
// will get tree-shaken away
|
|
15
|
+
if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
|
|
16
|
+
const sentryClient = getClient();
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
if (sentryClient && '$router' in nuxtApp) {
|
|
19
|
+
sentryClient.addIntegration(
|
|
20
|
+
browserTracingIntegration({ router: nuxtApp.$router , routeLabel: 'path' }),
|
|
21
|
+
);
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
|
-
}
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
nuxtApp.hook('app:created', vueApp => {
|
|
26
|
+
const sentryClient = getClient();
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
if (sentryClient) {
|
|
29
|
+
sentryClient.addIntegration(vueIntegration({ app: vueApp }));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
29
33
|
});
|
|
30
34
|
|
|
31
35
|
export { sentry_client as default };
|
|
@@ -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';\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(nuxtApp
|
|
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';\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 sentryClient.addIntegration(vueIntegration({ app: vueApp }));\n }\n });\n },\n});\n"],"names":[],"mappings":";;;;AAIA;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,QAAQ,YAAY,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,MAAA,EAAQ,CAAC,CAAC,CAAA;AACpE,OAAM;AACN,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
|
package/build/module/module.json
CHANGED
package/build/module/module.mjs
CHANGED
|
@@ -59,9 +59,17 @@ const module = defineNuxtModule({
|
|
|
59
59
|
addPluginTemplate({
|
|
60
60
|
mode: "client",
|
|
61
61
|
filename: "sentry-client-config.mjs",
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
// Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)
|
|
63
|
+
// Makes it possible to call useRuntimeConfig() in the user-defined sentry config file
|
|
64
|
+
getContents: () => `
|
|
65
|
+
import { defineNuxtPlugin } from "#imports";
|
|
66
|
+
|
|
67
|
+
export default defineNuxtPlugin({
|
|
68
|
+
name: 'sentry-client-config',
|
|
69
|
+
async setup() {
|
|
70
|
+
await import("${buildDirResolver.resolve(`/${clientConfigFile}`)}")
|
|
71
|
+
}
|
|
72
|
+
});`
|
|
65
73
|
});
|
|
66
74
|
addPlugin({ src: moduleDirResolver.resolve("./runtime/plugins/sentry.client"), mode: "client" });
|
|
67
75
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { getClient } from "@sentry/core";
|
|
2
2
|
import { browserTracingIntegration, vueIntegration } from "@sentry/vue";
|
|
3
3
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
4
|
-
export default defineNuxtPlugin(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
4
|
+
export default defineNuxtPlugin({
|
|
5
|
+
name: "sentry-client-integrations",
|
|
6
|
+
dependsOn: ["sentry-client-config"],
|
|
7
|
+
async setup(nuxtApp) {
|
|
8
|
+
if (typeof __SENTRY_TRACING__ === "undefined" || __SENTRY_TRACING__) {
|
|
9
|
+
const sentryClient = getClient();
|
|
10
|
+
if (sentryClient && "$router" in nuxtApp) {
|
|
11
|
+
sentryClient.addIntegration(
|
|
12
|
+
browserTracingIntegration({ router: nuxtApp.$router, routeLabel: "path" })
|
|
13
|
+
);
|
|
14
|
+
}
|
|
11
15
|
}
|
|
16
|
+
nuxtApp.hook("app:created", (vueApp) => {
|
|
17
|
+
const sentryClient = getClient();
|
|
18
|
+
if (sentryClient) {
|
|
19
|
+
sentryClient.addIntegration(vueIntegration({ app: vueApp }));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
12
22
|
}
|
|
13
|
-
nuxtApp.hook("app:created", (vueApp) => {
|
|
14
|
-
const sentryClient = getClient();
|
|
15
|
-
if (sentryClient) {
|
|
16
|
-
sentryClient.addIntegration(vueIntegration({ app: vueApp }));
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAG9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAG9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,wBAyDG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";AA+BA,
|
|
1
|
+
{"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";AA+BA,wBAwBG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/nuxt",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.28.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,14 +43,14 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@nuxt/kit": "^3.12.2",
|
|
46
|
-
"@sentry/browser": "8.
|
|
47
|
-
"@sentry/core": "8.
|
|
48
|
-
"@sentry/node": "8.
|
|
49
|
-
"@sentry/opentelemetry": "8.
|
|
50
|
-
"@sentry/types": "8.
|
|
51
|
-
"@sentry/utils": "8.
|
|
52
|
-
"@sentry/vite-plugin": "2.
|
|
53
|
-
"@sentry/vue": "8.
|
|
46
|
+
"@sentry/browser": "8.28.0",
|
|
47
|
+
"@sentry/core": "8.28.0",
|
|
48
|
+
"@sentry/node": "8.28.0",
|
|
49
|
+
"@sentry/opentelemetry": "8.28.0",
|
|
50
|
+
"@sentry/types": "8.28.0",
|
|
51
|
+
"@sentry/utils": "8.28.0",
|
|
52
|
+
"@sentry/vite-plugin": "2.22.3",
|
|
53
|
+
"@sentry/vue": "8.28.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@nuxt/module-builder": "0.8.1",
|