@sentry/nuxt 8.18.0 → 8.20.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 +29 -21
- package/build/cjs/client/sdk.js +1 -0
- package/build/cjs/client/sdk.js.map +1 -1
- package/build/esm/client/sdk.js +2 -1
- package/build/esm/client/sdk.js.map +1 -1
- package/build/module/module.d.mts +89 -4
- package/build/module/module.d.ts +89 -4
- package/build/module/module.json +1 -1
- package/build/module/module.mjs +44 -1
- package/build/types/client/sdk.d.ts.map +1 -1
- package/build/types/common/types.d.ts +88 -0
- package/build/types/common/types.d.ts.map +1 -1
- package/build/types/module.d.ts +3 -3
- package/build/types/module.d.ts.map +1 -1
- package/build/types/vite/sourceMaps.d.ts +7 -0
- package/build/types/vite/sourceMaps.d.ts.map +1 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -102,21 +102,6 @@ Sentry.init({
|
|
|
102
102
|
|
|
103
103
|
### 4. Server-side setup
|
|
104
104
|
|
|
105
|
-
Add a `sentry.server.config.(js|ts)` file to the root of your project:
|
|
106
|
-
|
|
107
|
-
```javascript
|
|
108
|
-
import * as Sentry from '@sentry/nuxt';
|
|
109
|
-
|
|
110
|
-
Sentry.init({
|
|
111
|
-
dsn: process.env.DSN,
|
|
112
|
-
});
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**Alternative Setup (ESM-compatible)**
|
|
116
|
-
|
|
117
|
-
This setup makes sure Sentry is imported on the server before any other imports. As of now, this however leads to an
|
|
118
|
-
import-in-the-middle error ([related reproduction](https://github.com/getsentry/sentry-javascript-examples/pull/38)).
|
|
119
|
-
|
|
120
105
|
Add an `instrument.server.mjs` file to your `public` folder:
|
|
121
106
|
|
|
122
107
|
```javascript
|
|
@@ -130,7 +115,8 @@ if (process.env.SENTRY_DSN) {
|
|
|
130
115
|
}
|
|
131
116
|
```
|
|
132
117
|
|
|
133
|
-
Add an import flag to the
|
|
118
|
+
Add an import flag to the `NODE_OPTIONS` of your preview script in the `package.json` file, so the file loads before any
|
|
119
|
+
other imports:
|
|
134
120
|
|
|
135
121
|
```json
|
|
136
122
|
{
|
|
@@ -140,12 +126,34 @@ Add an import flag to the node options, so the file loads before any other impor
|
|
|
140
126
|
}
|
|
141
127
|
```
|
|
142
128
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
129
|
+
If you are getting an `import-in-the-middle` error message, add the package with a minimum version of `1.10.0` as a
|
|
130
|
+
dependency to your `package.json`
|
|
131
|
+
([issue reference](https://github.com/getsentry/sentry-javascript-examples/pull/38#issuecomment-2245259327)):
|
|
146
132
|
|
|
147
|
-
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"dependencies": {
|
|
136
|
+
"import-in-the-middle": "1.10.0"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
148
140
|
|
|
149
141
|
## Uploading Source Maps
|
|
150
142
|
|
|
151
|
-
|
|
143
|
+
To upload source maps, you can use the `sourceMapsUploadOptions` option inside the `sentry` options of your
|
|
144
|
+
`nuxt.config.ts`:
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
// nuxt.config.ts
|
|
148
|
+
export default defineNuxtConfig({
|
|
149
|
+
modules: ['@sentry/nuxt/module'],
|
|
150
|
+
sentry: {
|
|
151
|
+
debug: true,
|
|
152
|
+
sourceMapsUploadOptions: {
|
|
153
|
+
org: 'your-org-slug',
|
|
154
|
+
project: 'your-project-slug',
|
|
155
|
+
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
```
|
package/build/cjs/client/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { init as initBrowser
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import {\n browserTracingIntegration,\n getDefaultIntegrations as getBrowserDefaultIntegrations,\n init as initBrowser,\n} from '@sentry/browser';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { Client } from '@sentry/types';\nimport type { SentryNuxtOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtOptions): Client | undefined {\n const sentryOptions = {\n defaultIntegrations: [...getBrowserDefaultIntegrations(options), browserTracingIntegration()],\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["getBrowserDefaultIntegrations","browserTracingIntegration","applySdkMetadata","initBrowser"],"mappings":";;;;;AASA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAyC;AACrE,EAAE,MAAM,gBAAgB;AACxB,IAAI,mBAAmB,EAAE,CAAC,GAAGA,8BAA6B,CAAC,OAAO,CAAC,EAAEC,iCAAyB,EAAE,CAAC;AACjG,IAAI,GAAG,OAAO;AACd,GAAG,CAAA;AACH;AACA,EAAEC,qBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AAC1D;AACA,EAAE,OAAOC,YAAW,CAAC,aAAa,CAAC,CAAA;AACnC;;;;"}
|
package/build/esm/client/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { init as init$1 } from '@sentry/browser';
|
|
1
|
+
import { getDefaultIntegrations, browserTracingIntegration, init as init$1 } from '@sentry/browser';
|
|
2
2
|
import { applySdkMetadata } from '@sentry/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,6 +8,7 @@ import { applySdkMetadata } from '@sentry/core';
|
|
|
8
8
|
*/
|
|
9
9
|
function init(options) {
|
|
10
10
|
const sentryOptions = {
|
|
11
|
+
defaultIntegrations: [...getDefaultIntegrations(options), browserTracingIntegration()],
|
|
11
12
|
...options,
|
|
12
13
|
};
|
|
13
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { init as initBrowser
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import {\n browserTracingIntegration,\n getDefaultIntegrations as getBrowserDefaultIntegrations,\n init as initBrowser,\n} from '@sentry/browser';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { Client } from '@sentry/types';\nimport type { SentryNuxtOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtOptions): Client | undefined {\n const sentryOptions = {\n defaultIntegrations: [...getBrowserDefaultIntegrations(options), browserTracingIntegration()],\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["getBrowserDefaultIntegrations","initBrowser"],"mappings":";;;AASA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAyC;AACrE,EAAE,MAAM,gBAAgB;AACxB,IAAI,mBAAmB,EAAE,CAAC,GAAGA,sBAA6B,CAAC,OAAO,CAAC,EAAE,yBAAyB,EAAE,CAAC;AACjG,IAAI,GAAG,OAAO;AACd,GAAG,CAAA;AACH;AACA,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AAC1D;AACA,EAAE,OAAOC,MAAW,CAAC,aAAa,CAAC,CAAA;AACnC;;;;"}
|
|
@@ -1,9 +1,94 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { init } from '@sentry/vue';
|
|
3
2
|
|
|
4
|
-
type
|
|
3
|
+
type SourceMapsOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Sentry Vite plugin to customize the source maps upload process.
|
|
6
|
+
*
|
|
7
|
+
* These options are always read from the `sentry` module options in the `nuxt.config.(js|ts).
|
|
8
|
+
* Do not define them in the `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.
|
|
9
|
+
*/
|
|
10
|
+
sourceMapsUploadOptions?: {
|
|
11
|
+
/**
|
|
12
|
+
* If this flag is `true`, and an auth token is detected, the Sentry integration will
|
|
13
|
+
* automatically generate and upload source maps to Sentry during a production build.
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The auth token to use when uploading source maps to Sentry.
|
|
20
|
+
*
|
|
21
|
+
* Instead of specifying this option, you can also set the `SENTRY_AUTH_TOKEN` environment variable.
|
|
22
|
+
*
|
|
23
|
+
* To create an auth token, follow this guide:
|
|
24
|
+
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
|
|
25
|
+
*/
|
|
26
|
+
authToken?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The organization slug of your Sentry organization.
|
|
29
|
+
* Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
|
|
30
|
+
*/
|
|
31
|
+
org?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The project slug of your Sentry project.
|
|
34
|
+
* Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
|
|
35
|
+
*/
|
|
36
|
+
project?: string;
|
|
37
|
+
/**
|
|
38
|
+
* If this flag is `true`, the Sentry plugin will collect some telemetry data and send it to Sentry.
|
|
39
|
+
* It will not collect any sensitive or user-specific data.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
telemetry?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Options related to sourcemaps
|
|
46
|
+
*/
|
|
47
|
+
sourcemaps?: {
|
|
48
|
+
/**
|
|
49
|
+
* A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
|
|
50
|
+
*
|
|
51
|
+
* If this option is not specified, sensible defaults based on your adapter and nuxt.config.js
|
|
52
|
+
* setup will be used. Use this option to override these defaults, for instance if you have a
|
|
53
|
+
* customized build setup that diverges from Nuxt's defaults.
|
|
54
|
+
*
|
|
55
|
+
* The globbing patterns must follow the implementation of the `glob` package.
|
|
56
|
+
* @see https://www.npmjs.com/package/glob#glob-primer
|
|
57
|
+
*/
|
|
58
|
+
assets?: string | Array<string>;
|
|
59
|
+
/**
|
|
60
|
+
* A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
|
|
61
|
+
*
|
|
62
|
+
* @default [] - By default no files are ignored. Thus, all files matching the `assets` glob
|
|
63
|
+
* or the default value for `assets` are uploaded.
|
|
64
|
+
*
|
|
65
|
+
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
66
|
+
*/
|
|
67
|
+
ignore?: string | Array<string>;
|
|
68
|
+
/**
|
|
69
|
+
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact
|
|
70
|
+
* upload to Sentry has been completed.
|
|
71
|
+
*
|
|
72
|
+
* @default [] - By default no files are deleted.
|
|
73
|
+
*
|
|
74
|
+
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
75
|
+
*/
|
|
76
|
+
filesToDeleteAfterUpload?: string | Array<string>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
|
|
82
|
+
*/
|
|
83
|
+
type SentryNuxtModuleOptions = SourceMapsOptions & {
|
|
84
|
+
/**
|
|
85
|
+
* Enable debug functionality of the SDK during build-time.
|
|
86
|
+
* Enabling this will give you, for example, logs about source maps.
|
|
87
|
+
*/
|
|
88
|
+
debug?: boolean;
|
|
89
|
+
};
|
|
5
90
|
|
|
6
|
-
type ModuleOptions =
|
|
7
|
-
declare const _default: _nuxt_schema.NuxtModule<
|
|
91
|
+
type ModuleOptions = SentryNuxtModuleOptions;
|
|
92
|
+
declare const _default: _nuxt_schema.NuxtModule<SentryNuxtModuleOptions>;
|
|
8
93
|
|
|
9
94
|
export { type ModuleOptions, _default as default };
|
package/build/module/module.d.ts
CHANGED
|
@@ -1,9 +1,94 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { init } from '@sentry/vue';
|
|
3
2
|
|
|
4
|
-
type
|
|
3
|
+
type SourceMapsOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Sentry Vite plugin to customize the source maps upload process.
|
|
6
|
+
*
|
|
7
|
+
* These options are always read from the `sentry` module options in the `nuxt.config.(js|ts).
|
|
8
|
+
* Do not define them in the `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.
|
|
9
|
+
*/
|
|
10
|
+
sourceMapsUploadOptions?: {
|
|
11
|
+
/**
|
|
12
|
+
* If this flag is `true`, and an auth token is detected, the Sentry integration will
|
|
13
|
+
* automatically generate and upload source maps to Sentry during a production build.
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The auth token to use when uploading source maps to Sentry.
|
|
20
|
+
*
|
|
21
|
+
* Instead of specifying this option, you can also set the `SENTRY_AUTH_TOKEN` environment variable.
|
|
22
|
+
*
|
|
23
|
+
* To create an auth token, follow this guide:
|
|
24
|
+
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
|
|
25
|
+
*/
|
|
26
|
+
authToken?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The organization slug of your Sentry organization.
|
|
29
|
+
* Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
|
|
30
|
+
*/
|
|
31
|
+
org?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The project slug of your Sentry project.
|
|
34
|
+
* Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
|
|
35
|
+
*/
|
|
36
|
+
project?: string;
|
|
37
|
+
/**
|
|
38
|
+
* If this flag is `true`, the Sentry plugin will collect some telemetry data and send it to Sentry.
|
|
39
|
+
* It will not collect any sensitive or user-specific data.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
telemetry?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Options related to sourcemaps
|
|
46
|
+
*/
|
|
47
|
+
sourcemaps?: {
|
|
48
|
+
/**
|
|
49
|
+
* A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
|
|
50
|
+
*
|
|
51
|
+
* If this option is not specified, sensible defaults based on your adapter and nuxt.config.js
|
|
52
|
+
* setup will be used. Use this option to override these defaults, for instance if you have a
|
|
53
|
+
* customized build setup that diverges from Nuxt's defaults.
|
|
54
|
+
*
|
|
55
|
+
* The globbing patterns must follow the implementation of the `glob` package.
|
|
56
|
+
* @see https://www.npmjs.com/package/glob#glob-primer
|
|
57
|
+
*/
|
|
58
|
+
assets?: string | Array<string>;
|
|
59
|
+
/**
|
|
60
|
+
* A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
|
|
61
|
+
*
|
|
62
|
+
* @default [] - By default no files are ignored. Thus, all files matching the `assets` glob
|
|
63
|
+
* or the default value for `assets` are uploaded.
|
|
64
|
+
*
|
|
65
|
+
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
66
|
+
*/
|
|
67
|
+
ignore?: string | Array<string>;
|
|
68
|
+
/**
|
|
69
|
+
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact
|
|
70
|
+
* upload to Sentry has been completed.
|
|
71
|
+
*
|
|
72
|
+
* @default [] - By default no files are deleted.
|
|
73
|
+
*
|
|
74
|
+
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
75
|
+
*/
|
|
76
|
+
filesToDeleteAfterUpload?: string | Array<string>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
|
|
82
|
+
*/
|
|
83
|
+
type SentryNuxtModuleOptions = SourceMapsOptions & {
|
|
84
|
+
/**
|
|
85
|
+
* Enable debug functionality of the SDK during build-time.
|
|
86
|
+
* Enabling this will give you, for example, logs about source maps.
|
|
87
|
+
*/
|
|
88
|
+
debug?: boolean;
|
|
89
|
+
};
|
|
5
90
|
|
|
6
|
-
type ModuleOptions =
|
|
7
|
-
declare const _default: _nuxt_schema.NuxtModule<
|
|
91
|
+
type ModuleOptions = SentryNuxtModuleOptions;
|
|
92
|
+
declare const _default: _nuxt_schema.NuxtModule<SentryNuxtModuleOptions>;
|
|
8
93
|
|
|
9
94
|
export { type ModuleOptions, _default as default };
|
package/build/module/module.json
CHANGED
package/build/module/module.mjs
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { defineNuxtModule, createResolver, addPluginTemplate, addPlugin, addServerPlugin } from '@nuxt/kit';
|
|
4
|
+
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
|
5
|
+
|
|
6
|
+
function setupSourceMaps(moduleOptions, nuxt) {
|
|
7
|
+
nuxt.hook("vite:extendConfig", async (viteInlineConfig, _env) => {
|
|
8
|
+
const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
|
|
9
|
+
if ((sourceMapsUploadOptions.enabled ?? true) && viteInlineConfig.mode !== "development") {
|
|
10
|
+
const sentryPlugin = sentryVitePlugin({
|
|
11
|
+
org: sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,
|
|
12
|
+
project: sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,
|
|
13
|
+
authToken: sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,
|
|
14
|
+
telemetry: sourceMapsUploadOptions.telemetry ?? true,
|
|
15
|
+
sourcemaps: {
|
|
16
|
+
assets: sourceMapsUploadOptions.sourcemaps?.assets ?? void 0,
|
|
17
|
+
ignore: sourceMapsUploadOptions.sourcemaps?.ignore ?? void 0,
|
|
18
|
+
filesToDeleteAfterUpload: sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload ?? void 0
|
|
19
|
+
},
|
|
20
|
+
_metaOptions: {
|
|
21
|
+
telemetry: {
|
|
22
|
+
metaFramework: "nuxt"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
debug: moduleOptions.debug ?? false
|
|
26
|
+
});
|
|
27
|
+
viteInlineConfig.plugins = viteInlineConfig.plugins || [];
|
|
28
|
+
viteInlineConfig.plugins.push(sentryPlugin);
|
|
29
|
+
const sourceMapsPreviouslyEnabled = viteInlineConfig.build?.sourcemap;
|
|
30
|
+
if (moduleOptions.debug && !sourceMapsPreviouslyEnabled) {
|
|
31
|
+
console.log("[Sentry]: Enabled source maps generation in the Vite build options.");
|
|
32
|
+
if (!moduleOptions.sourceMapsUploadOptions?.sourcemaps?.filesToDeleteAfterUpload) {
|
|
33
|
+
console.warn(
|
|
34
|
+
`[Sentry] We recommend setting the \`sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload\` option to clean up source maps after uploading.
|
|
35
|
+
[Sentry] Otherwise, source maps might be deployed to production, depending on your configuration`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
viteInlineConfig.build = viteInlineConfig.build || {};
|
|
40
|
+
viteInlineConfig.build.sourcemap = true;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
4
44
|
|
|
5
45
|
const module = defineNuxtModule({
|
|
6
46
|
meta: {
|
|
@@ -11,7 +51,7 @@ const module = defineNuxtModule({
|
|
|
11
51
|
}
|
|
12
52
|
},
|
|
13
53
|
defaults: {},
|
|
14
|
-
setup(
|
|
54
|
+
setup(moduleOptions, nuxt) {
|
|
15
55
|
const moduleDirResolver = createResolver(import.meta.url);
|
|
16
56
|
const buildDirResolver = createResolver(nuxt.options.buildDir);
|
|
17
57
|
const clientConfigFile = findDefaultSdkInitFile("client");
|
|
@@ -34,6 +74,9 @@ export default defineNuxtPlugin(() => {})`
|
|
|
34
74
|
});
|
|
35
75
|
addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/sentry.server"));
|
|
36
76
|
}
|
|
77
|
+
if (clientConfigFile || serverConfigFile) {
|
|
78
|
+
setupSourceMaps(moduleOptions, nuxt);
|
|
79
|
+
}
|
|
37
80
|
}
|
|
38
81
|
});
|
|
39
82
|
function findDefaultSdkInitFile(type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/client/sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/client/sdk.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CASnE"}
|
|
@@ -1,3 +1,91 @@
|
|
|
1
1
|
import type { init } from '@sentry/vue';
|
|
2
2
|
export type SentryNuxtOptions = Omit<Parameters<typeof init>[0] & object, 'app'>;
|
|
3
|
+
type SourceMapsOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Sentry Vite plugin to customize the source maps upload process.
|
|
6
|
+
*
|
|
7
|
+
* These options are always read from the `sentry` module options in the `nuxt.config.(js|ts).
|
|
8
|
+
* Do not define them in the `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.
|
|
9
|
+
*/
|
|
10
|
+
sourceMapsUploadOptions?: {
|
|
11
|
+
/**
|
|
12
|
+
* If this flag is `true`, and an auth token is detected, the Sentry integration will
|
|
13
|
+
* automatically generate and upload source maps to Sentry during a production build.
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The auth token to use when uploading source maps to Sentry.
|
|
20
|
+
*
|
|
21
|
+
* Instead of specifying this option, you can also set the `SENTRY_AUTH_TOKEN` environment variable.
|
|
22
|
+
*
|
|
23
|
+
* To create an auth token, follow this guide:
|
|
24
|
+
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
|
|
25
|
+
*/
|
|
26
|
+
authToken?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The organization slug of your Sentry organization.
|
|
29
|
+
* Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
|
|
30
|
+
*/
|
|
31
|
+
org?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The project slug of your Sentry project.
|
|
34
|
+
* Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
|
|
35
|
+
*/
|
|
36
|
+
project?: string;
|
|
37
|
+
/**
|
|
38
|
+
* If this flag is `true`, the Sentry plugin will collect some telemetry data and send it to Sentry.
|
|
39
|
+
* It will not collect any sensitive or user-specific data.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
telemetry?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Options related to sourcemaps
|
|
46
|
+
*/
|
|
47
|
+
sourcemaps?: {
|
|
48
|
+
/**
|
|
49
|
+
* A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
|
|
50
|
+
*
|
|
51
|
+
* If this option is not specified, sensible defaults based on your adapter and nuxt.config.js
|
|
52
|
+
* setup will be used. Use this option to override these defaults, for instance if you have a
|
|
53
|
+
* customized build setup that diverges from Nuxt's defaults.
|
|
54
|
+
*
|
|
55
|
+
* The globbing patterns must follow the implementation of the `glob` package.
|
|
56
|
+
* @see https://www.npmjs.com/package/glob#glob-primer
|
|
57
|
+
*/
|
|
58
|
+
assets?: string | Array<string>;
|
|
59
|
+
/**
|
|
60
|
+
* A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
|
|
61
|
+
*
|
|
62
|
+
* @default [] - By default no files are ignored. Thus, all files matching the `assets` glob
|
|
63
|
+
* or the default value for `assets` are uploaded.
|
|
64
|
+
*
|
|
65
|
+
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
66
|
+
*/
|
|
67
|
+
ignore?: string | Array<string>;
|
|
68
|
+
/**
|
|
69
|
+
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact
|
|
70
|
+
* upload to Sentry has been completed.
|
|
71
|
+
*
|
|
72
|
+
* @default [] - By default no files are deleted.
|
|
73
|
+
*
|
|
74
|
+
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
75
|
+
*/
|
|
76
|
+
filesToDeleteAfterUpload?: string | Array<string>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
|
|
82
|
+
*/
|
|
83
|
+
export type SentryNuxtModuleOptions = SourceMapsOptions & {
|
|
84
|
+
/**
|
|
85
|
+
* Enable debug functionality of the SDK during build-time.
|
|
86
|
+
* Enabling this will give you, for example, logs about source maps.
|
|
87
|
+
*/
|
|
88
|
+
debug?: boolean;
|
|
89
|
+
};
|
|
90
|
+
export {};
|
|
3
91
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAEjF,KAAK,iBAAiB,GAAG;IACvB;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE;QACxB;;;;;WAKG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAElB;;;;;;;WAOG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;;WAGG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;;;;WAKG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;QAEpB;;WAEG;QACH,UAAU,CAAC,EAAE;YACX;;;;;;;;;eASG;YACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YAEhC;;;;;;;eAOG;YACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YAEhC;;;;;;;eAOG;YACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;SACnD,CAAC;KACH,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG;IACxD;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
package/build/types/module.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type ModuleOptions =
|
|
3
|
-
declare const _default: import("@nuxt/schema").NuxtModule<
|
|
1
|
+
import type { SentryNuxtModuleOptions } from './common/types';
|
|
2
|
+
export type ModuleOptions = SentryNuxtModuleOptions;
|
|
3
|
+
declare const _default: import("@nuxt/schema").NuxtModule<SentryNuxtModuleOptions>;
|
|
4
4
|
export default _default;
|
|
5
5
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
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,wBA+CG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Nuxt } from '@nuxt/schema';
|
|
2
|
+
import type { SentryNuxtModuleOptions } from '../common/types';
|
|
3
|
+
/**
|
|
4
|
+
* Setup source maps for Sentry inside the Nuxt module during build time.
|
|
5
|
+
*/
|
|
6
|
+
export declare function setupSourceMaps(moduleOptions: SentryNuxtModuleOptions, nuxt: Nuxt): void;
|
|
7
|
+
//# sourceMappingURL=sourceMaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceMaps.d.ts","sourceRoot":"","sources":["../../../src/vite/sourceMaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;GAEG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CA4CxF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/nuxt",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.20.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.
|
|
46
|
+
"@sentry/browser": "8.20.0",
|
|
47
|
+
"@sentry/core": "8.20.0",
|
|
48
|
+
"@sentry/node": "8.20.0",
|
|
49
|
+
"@sentry/opentelemetry": "8.20.0",
|
|
50
|
+
"@sentry/types": "8.20.0",
|
|
51
|
+
"@sentry/utils": "8.20.0",
|
|
52
52
|
"@sentry/vite-plugin": "2.20.1",
|
|
53
|
-
"@sentry/vue": "8.
|
|
53
|
+
"@sentry/vue": "8.20.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@nuxt/module-builder": "0.8.0",
|