@sentry/nuxt 10.0.0 → 10.2.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/build/cjs/vite/sourceMaps.js +102 -78
- package/build/cjs/vite/sourceMaps.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/vite/sourceMaps.js +102 -78
- package/build/esm/vite/sourceMaps.js.map +1 -1
- package/build/module/module.d.mts +27 -6
- package/build/module/module.d.ts +27 -6
- package/build/module/module.json +1 -1
- package/build/module/module.mjs +73 -65
- package/build/module/runtime/plugins/sentry.server.js +12 -2
- package/build/types/common/types.d.ts +27 -6
- package/build/types/common/types.d.ts.map +1 -1
- package/build/types/runtime/plugins/sentry.server.d.ts.map +1 -1
- package/build/types/vite/sourceMaps.d.ts.map +1 -1
- package/package.json +7 -7
package/build/module/module.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { BuildTimeOptionsBase } from '@sentry/core';
|
|
2
3
|
import { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
|
|
3
4
|
import { SentryVitePluginOptions } from '@sentry/vite-plugin';
|
|
4
5
|
|
|
@@ -7,6 +8,7 @@ type SourceMapsOptions = {
|
|
|
7
8
|
* Suppresses all logs.
|
|
8
9
|
*
|
|
9
10
|
* @default false
|
|
11
|
+
* @deprecated Use option `silent` instead of `sourceMapsUploadOptions.silent`
|
|
10
12
|
*/
|
|
11
13
|
silent?: boolean;
|
|
12
14
|
/**
|
|
@@ -23,12 +25,16 @@ type SourceMapsOptions = {
|
|
|
23
25
|
* console.warn(err);
|
|
24
26
|
* }
|
|
25
27
|
* ```
|
|
28
|
+
*
|
|
29
|
+
* @deprecated Use option `errorHandler` instead of `sourceMapsUploadOptions.errorHandler`
|
|
26
30
|
*/
|
|
27
31
|
errorHandler?: (err: Error) => void;
|
|
28
32
|
/**
|
|
29
33
|
* Options related to managing the Sentry releases for a build.
|
|
30
34
|
*
|
|
31
35
|
* More info: https://docs.sentry.io/product/releases/
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Use option `release` instead of `sourceMapsUploadOptions.release`
|
|
32
38
|
*/
|
|
33
39
|
release?: {
|
|
34
40
|
/**
|
|
@@ -41,6 +47,8 @@ type SourceMapsOptions = {
|
|
|
41
47
|
* (the latter requires access to git CLI and for the root directory to be a valid repository)
|
|
42
48
|
*
|
|
43
49
|
* If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
|
|
50
|
+
*
|
|
51
|
+
* @deprecated Use `release.name` instead of `sourceMapsUploadOptions.release.name`
|
|
44
52
|
*/
|
|
45
53
|
name?: string;
|
|
46
54
|
};
|
|
@@ -49,6 +57,7 @@ type SourceMapsOptions = {
|
|
|
49
57
|
* automatically generate and upload source maps to Sentry during a production build.
|
|
50
58
|
*
|
|
51
59
|
* @default true
|
|
60
|
+
* @deprecated Use option `sourcemaps.disable` instead of `sourceMapsUploadOptions.enabled`
|
|
52
61
|
*/
|
|
53
62
|
enabled?: boolean;
|
|
54
63
|
/**
|
|
@@ -58,22 +67,27 @@ type SourceMapsOptions = {
|
|
|
58
67
|
*
|
|
59
68
|
* To create an auth token, follow this guide:
|
|
60
69
|
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
|
|
70
|
+
* @deprecated Use option `authToken` instead of `sourceMapsUploadOptions.authToken`
|
|
61
71
|
*/
|
|
62
72
|
authToken?: string;
|
|
63
73
|
/**
|
|
64
74
|
* The organization slug of your Sentry organization.
|
|
65
75
|
* Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
|
|
76
|
+
* @deprecated Use option `org` instead of `sourceMapsUploadOptions.org`
|
|
66
77
|
*/
|
|
67
78
|
org?: string;
|
|
68
79
|
/**
|
|
69
80
|
* The URL of your Sentry instance if you're using self-hosted Sentry.
|
|
70
81
|
*
|
|
71
82
|
* @default https://sentry.io by default the plugin will point towards the Sentry SaaS URL
|
|
83
|
+
* @deprecated Use `sentryUrl` instead of `sourceMapsUploadOptions.url`
|
|
72
84
|
*/
|
|
73
85
|
url?: string;
|
|
74
86
|
/**
|
|
75
87
|
* The project slug of your Sentry project.
|
|
76
88
|
* Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
|
|
89
|
+
*
|
|
90
|
+
* @deprecated Use option `project` instead of `sourceMapsUploadOptions.project`
|
|
77
91
|
*/
|
|
78
92
|
project?: string;
|
|
79
93
|
/**
|
|
@@ -81,10 +95,13 @@ type SourceMapsOptions = {
|
|
|
81
95
|
* It will not collect any sensitive or user-specific data.
|
|
82
96
|
*
|
|
83
97
|
* @default true
|
|
98
|
+
* @deprecated Use option `telemetry` instead of `sourceMapsUploadOptions.telemetry`
|
|
84
99
|
*/
|
|
85
100
|
telemetry?: boolean;
|
|
86
101
|
/**
|
|
87
102
|
* Options related to sourcemaps
|
|
103
|
+
*
|
|
104
|
+
* @deprecated Use option `sourcemaps` instead of `sourceMapsUploadOptions.sourcemaps`
|
|
88
105
|
*/
|
|
89
106
|
sourcemaps?: {
|
|
90
107
|
/**
|
|
@@ -96,6 +113,8 @@ type SourceMapsOptions = {
|
|
|
96
113
|
*
|
|
97
114
|
* The globbing patterns must follow the implementation of the `glob` package.
|
|
98
115
|
* @see https://www.npmjs.com/package/glob#glob-primer
|
|
116
|
+
*
|
|
117
|
+
* @deprecated Use option `sourcemaps.assets` instead of `sourceMapsUploadOptions.sourcemaps.assets`
|
|
99
118
|
*/
|
|
100
119
|
assets?: string | Array<string>;
|
|
101
120
|
/**
|
|
@@ -105,6 +124,8 @@ type SourceMapsOptions = {
|
|
|
105
124
|
* or the default value for `assets` are uploaded.
|
|
106
125
|
*
|
|
107
126
|
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
127
|
+
*
|
|
128
|
+
* @deprecated Use option `sourcemaps.ignore` instead of `sourceMapsUploadOptions.sourcemaps.ignore`
|
|
108
129
|
*/
|
|
109
130
|
ignore?: string | Array<string>;
|
|
110
131
|
/**
|
|
@@ -114,6 +135,8 @@ type SourceMapsOptions = {
|
|
|
114
135
|
* @default [] - By default no files are deleted.
|
|
115
136
|
*
|
|
116
137
|
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
138
|
+
*
|
|
139
|
+
* @deprecated Use option `sourcemaps.filesToDeleteAfterUpload` instead of `sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload`
|
|
117
140
|
*/
|
|
118
141
|
filesToDeleteAfterUpload?: string | Array<string>;
|
|
119
142
|
};
|
|
@@ -121,7 +144,7 @@ type SourceMapsOptions = {
|
|
|
121
144
|
/**
|
|
122
145
|
* Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
|
|
123
146
|
*/
|
|
124
|
-
type SentryNuxtModuleOptions = {
|
|
147
|
+
type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
|
|
125
148
|
/**
|
|
126
149
|
* Enable the Sentry Nuxt Module.
|
|
127
150
|
*
|
|
@@ -133,13 +156,11 @@ type SentryNuxtModuleOptions = {
|
|
|
133
156
|
*
|
|
134
157
|
* These options are always read from the `sentry` module options in the `nuxt.config.(js|ts).
|
|
135
158
|
* Do not define them in the `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.
|
|
159
|
+
*
|
|
160
|
+
* @deprecated This option was deprecated as it adds unnecessary nesting.
|
|
161
|
+
* Put the options one level higher to the root-level of the `sentry` module options.
|
|
136
162
|
*/
|
|
137
163
|
sourceMapsUploadOptions?: SourceMapsOptions;
|
|
138
|
-
/**
|
|
139
|
-
* Enable debug functionality of the SDK during build-time.
|
|
140
|
-
* Enabling this will give you, for example, logs about source maps.
|
|
141
|
-
*/
|
|
142
|
-
debug?: boolean;
|
|
143
164
|
/**
|
|
144
165
|
*
|
|
145
166
|
* Enables (partial) server tracing by automatically injecting Sentry for environments where modifying the node option `--import` is not possible.
|
package/build/module/module.json
CHANGED
package/build/module/module.mjs
CHANGED
|
@@ -256,7 +256,10 @@ ${reExportedFunctions}
|
|
|
256
256
|
function setupSourceMaps(moduleOptions, nuxt) {
|
|
257
257
|
const isDebug = moduleOptions.debug;
|
|
258
258
|
const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
|
|
259
|
-
const sourceMapsEnabled =
|
|
259
|
+
const sourceMapsEnabled = moduleOptions.sourcemaps?.disable === true ? false : moduleOptions.sourcemaps?.disable === false ? true : (
|
|
260
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
261
|
+
sourceMapsUploadOptions.enabled ?? true
|
|
262
|
+
);
|
|
260
263
|
let shouldDeleteFilesFallback = { client: true, server: true };
|
|
261
264
|
nuxt.hook("modules:done", () => {
|
|
262
265
|
if (sourceMapsEnabled && !nuxt.options.dev) {
|
|
@@ -265,14 +268,10 @@ function setupSourceMaps(moduleOptions, nuxt) {
|
|
|
265
268
|
client: previousSourceMapSettings.client === "unset",
|
|
266
269
|
server: previousSourceMapSettings.server === "unset"
|
|
267
270
|
};
|
|
268
|
-
if (isDebug && !
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
console.log(
|
|
273
|
-
"[Sentry] As Sentry enabled `'hidden'` source maps, source maps will be automatically deleted after uploading them to Sentry."
|
|
274
|
-
)
|
|
275
|
-
)
|
|
271
|
+
if (isDebug && !moduleOptions.sourcemaps?.filesToDeleteAfterUpload && // eslint-disable-next-line deprecation/deprecation
|
|
272
|
+
!sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload && (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)) {
|
|
273
|
+
console.log(
|
|
274
|
+
"[Sentry] As Sentry enabled `'hidden'` source maps, source maps will be automatically deleted after uploading them to Sentry."
|
|
276
275
|
);
|
|
277
276
|
}
|
|
278
277
|
}
|
|
@@ -290,13 +289,11 @@ function setupSourceMaps(moduleOptions, nuxt) {
|
|
|
290
289
|
otherSettingValue: viteSourceMap
|
|
291
290
|
});
|
|
292
291
|
if (isDebug) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
});
|
|
292
|
+
if (!runtime) {
|
|
293
|
+
console.log("[Sentry] Cannot detect runtime (client/server) inside hook 'vite:extendConfig'.");
|
|
294
|
+
} else {
|
|
295
|
+
console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);
|
|
296
|
+
}
|
|
300
297
|
}
|
|
301
298
|
viteConfig.plugins = viteConfig.plugins || [];
|
|
302
299
|
viteConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));
|
|
@@ -314,9 +311,7 @@ function setupSourceMaps(moduleOptions, nuxt) {
|
|
|
314
311
|
}
|
|
315
312
|
validateNitroSourceMapSettings(nuxt, nitroConfig, moduleOptions);
|
|
316
313
|
if (isDebug) {
|
|
317
|
-
|
|
318
|
-
console.log("[Sentry] Adding Sentry Rollup plugin to the server runtime.");
|
|
319
|
-
});
|
|
314
|
+
console.log("[Sentry] Adding Sentry Rollup plugin to the server runtime.");
|
|
320
315
|
}
|
|
321
316
|
nitroConfig.rollupConfig.plugins.push(
|
|
322
317
|
sentryRollupPlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback))
|
|
@@ -334,24 +329,39 @@ function getPluginOptions(moduleOptions, shouldDeleteFilesFallback) {
|
|
|
334
329
|
...shouldDeleteFilesFallback?.client ? [".*/**/public/**/*.map"] : [],
|
|
335
330
|
...shouldDeleteFilesFallback?.server ? [".*/**/server/**/*.map", ".*/**/output/**/*.map", ".*/**/function/**/*.map"] : []
|
|
336
331
|
];
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
332
|
+
const sourcemapsOptions = moduleOptions.sourcemaps || {};
|
|
333
|
+
const deprecatedSourcemapsOptions = sourceMapsUploadOptions.sourcemaps || {};
|
|
334
|
+
const filesToDeleteAfterUpload = sourcemapsOptions.filesToDeleteAfterUpload ?? // eslint-disable-next-line deprecation/deprecation
|
|
335
|
+
deprecatedSourcemapsOptions.filesToDeleteAfterUpload;
|
|
336
|
+
if (typeof filesToDeleteAfterUpload === "undefined" && shouldDeleteFilesAfterUpload && moduleOptions.debug) {
|
|
337
|
+
console.log(
|
|
338
|
+
`[Sentry] Setting \`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete.map((path) => `"${path}"`).join(", ")}]\` to delete generated source maps after they were uploaded to Sentry.`
|
|
339
|
+
);
|
|
343
340
|
}
|
|
344
341
|
return {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
342
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
343
|
+
org: moduleOptions.org ?? sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,
|
|
344
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
345
|
+
project: moduleOptions.project ?? sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,
|
|
346
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
347
|
+
authToken: moduleOptions.authToken ?? sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,
|
|
348
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
349
|
+
telemetry: moduleOptions.telemetry ?? sourceMapsUploadOptions.telemetry ?? true,
|
|
350
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
351
|
+
url: moduleOptions.sentryUrl ?? sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,
|
|
352
|
+
headers: moduleOptions.headers,
|
|
350
353
|
debug: moduleOptions.debug ?? false,
|
|
351
|
-
|
|
352
|
-
|
|
354
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
355
|
+
silent: moduleOptions.silent ?? sourceMapsUploadOptions.silent ?? false,
|
|
356
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
357
|
+
errorHandler: moduleOptions.errorHandler ?? sourceMapsUploadOptions.errorHandler,
|
|
358
|
+
bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations,
|
|
359
|
+
// todo: test if this can be overridden by the user
|
|
353
360
|
release: {
|
|
354
|
-
|
|
361
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
362
|
+
name: moduleOptions.release?.name ?? sourceMapsUploadOptions.release?.name,
|
|
363
|
+
// Support all release options from BuildTimeOptionsBase
|
|
364
|
+
...moduleOptions.release,
|
|
355
365
|
...moduleOptions?.unstable_sentryBundlerPluginOptions?.release
|
|
356
366
|
},
|
|
357
367
|
_metaOptions: {
|
|
@@ -361,12 +371,15 @@ function getPluginOptions(moduleOptions, shouldDeleteFilesFallback) {
|
|
|
361
371
|
},
|
|
362
372
|
...moduleOptions?.unstable_sentryBundlerPluginOptions,
|
|
363
373
|
sourcemaps: {
|
|
374
|
+
disable: moduleOptions.sourcemaps?.disable,
|
|
364
375
|
// The server/client files are in different places depending on the nitro preset (e.g. '.output/server' or '.netlify/functions-internal/server')
|
|
365
376
|
// We cannot determine automatically how the build folder looks like (depends on the preset), so we have to accept that source maps are uploaded multiple times (with the vitePlugin for Nuxt and the rollupPlugin for Nitro).
|
|
366
377
|
// If we could know where the server/client assets are located, we could do something like this (based on the Nitro preset): isNitro ? ['./.output/server/**/*'] : ['./.output/public/**/*'],
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
378
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
379
|
+
assets: sourcemapsOptions.assets ?? deprecatedSourcemapsOptions.assets ?? void 0,
|
|
380
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
381
|
+
ignore: sourcemapsOptions.ignore ?? deprecatedSourcemapsOptions.ignore ?? void 0,
|
|
382
|
+
filesToDeleteAfterUpload: filesToDeleteAfterUpload ? filesToDeleteAfterUpload : shouldDeleteFilesFallback?.server || shouldDeleteFilesFallback?.client ? fallbackFilesToDelete : void 0,
|
|
370
383
|
rewriteSources: (source) => normalizePath(source),
|
|
371
384
|
...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps
|
|
372
385
|
}
|
|
@@ -386,10 +399,11 @@ function changeNuxtSourceMapSettings(nuxt, sentryModuleOptions) {
|
|
|
386
399
|
server: void 0
|
|
387
400
|
};
|
|
388
401
|
const nuxtSourceMap = nuxt.options.sourcemap;
|
|
402
|
+
const isDebug = sentryModuleOptions.debug;
|
|
389
403
|
if (typeof nuxtSourceMap === "string" || typeof nuxtSourceMap === "boolean" || typeof nuxtSourceMap === "undefined") {
|
|
390
404
|
switch (nuxtSourceMap) {
|
|
391
405
|
case false:
|
|
392
|
-
warnExplicitlyDisabledSourceMap("sourcemap");
|
|
406
|
+
warnExplicitlyDisabledSourceMap("sourcemap", isDebug);
|
|
393
407
|
previousUserSourceMapSetting = { client: "disabled", server: "disabled" };
|
|
394
408
|
break;
|
|
395
409
|
case "hidden":
|
|
@@ -399,32 +413,32 @@ function changeNuxtSourceMapSettings(nuxt, sentryModuleOptions) {
|
|
|
399
413
|
break;
|
|
400
414
|
case void 0:
|
|
401
415
|
nuxt.options.sourcemap = { server: "hidden", client: "hidden" };
|
|
402
|
-
logSentryEnablesSourceMap("sourcemap.client", "hidden");
|
|
403
|
-
logSentryEnablesSourceMap("sourcemap.server", "hidden");
|
|
416
|
+
isDebug && logSentryEnablesSourceMap("sourcemap.client", "hidden");
|
|
417
|
+
isDebug && logSentryEnablesSourceMap("sourcemap.server", "hidden");
|
|
404
418
|
previousUserSourceMapSetting = { client: "unset", server: "unset" };
|
|
405
419
|
break;
|
|
406
420
|
}
|
|
407
421
|
} else {
|
|
408
422
|
if (nuxtSourceMap.client === false) {
|
|
409
|
-
warnExplicitlyDisabledSourceMap("sourcemap.client");
|
|
423
|
+
warnExplicitlyDisabledSourceMap("sourcemap.client", isDebug);
|
|
410
424
|
previousUserSourceMapSetting.client = "disabled";
|
|
411
425
|
} else if (["hidden", true].includes(nuxtSourceMap.client)) {
|
|
412
426
|
logKeepEnabledSourceMapSetting(sentryModuleOptions, "sourcemap.client", nuxtSourceMap.client.toString());
|
|
413
427
|
previousUserSourceMapSetting.client = "enabled";
|
|
414
428
|
} else {
|
|
415
429
|
nuxt.options.sourcemap.client = "hidden";
|
|
416
|
-
logSentryEnablesSourceMap("sourcemap.client", "hidden");
|
|
430
|
+
isDebug && logSentryEnablesSourceMap("sourcemap.client", "hidden");
|
|
417
431
|
previousUserSourceMapSetting.client = "unset";
|
|
418
432
|
}
|
|
419
433
|
if (nuxtSourceMap.server === false) {
|
|
420
|
-
warnExplicitlyDisabledSourceMap("sourcemap.server");
|
|
434
|
+
warnExplicitlyDisabledSourceMap("sourcemap.server", isDebug);
|
|
421
435
|
previousUserSourceMapSetting.server = "disabled";
|
|
422
436
|
} else if (["hidden", true].includes(nuxtSourceMap.server)) {
|
|
423
437
|
logKeepEnabledSourceMapSetting(sentryModuleOptions, "sourcemap.server", nuxtSourceMap.server.toString());
|
|
424
438
|
previousUserSourceMapSetting.server = "enabled";
|
|
425
439
|
} else {
|
|
426
440
|
nuxt.options.sourcemap.server = "hidden";
|
|
427
|
-
logSentryEnablesSourceMap("sourcemap.server", "hidden");
|
|
441
|
+
isDebug && logSentryEnablesSourceMap("sourcemap.server", "hidden");
|
|
428
442
|
previousUserSourceMapSetting.server = "unset";
|
|
429
443
|
}
|
|
430
444
|
}
|
|
@@ -453,11 +467,9 @@ function validateNitroSourceMapSettings(nuxt, nitroConfig, sentryModuleOptions)
|
|
|
453
467
|
}
|
|
454
468
|
nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;
|
|
455
469
|
if (isDebug) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
);
|
|
460
|
-
});
|
|
470
|
+
console.log(
|
|
471
|
+
"[Sentry] Set `sourcemapExcludeSources: false` in the Nuxt config (`nitro.rollupConfig.output`). Source maps will now include the actual code to be able to un-minify code snippets in Sentry."
|
|
472
|
+
);
|
|
461
473
|
}
|
|
462
474
|
}
|
|
463
475
|
function validateDifferentSourceMapSettings({
|
|
@@ -467,33 +479,29 @@ function validateDifferentSourceMapSettings({
|
|
|
467
479
|
otherSettingValue
|
|
468
480
|
}) {
|
|
469
481
|
if (nuxtSettingValue !== otherSettingValue) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
);
|
|
474
|
-
});
|
|
482
|
+
console.warn(
|
|
483
|
+
`[Sentry] Source map generation settings are conflicting. Sentry uses \`${nuxtSettingKey}: ${nuxtSettingValue}\`. However, a conflicting setting was discovered (\`${otherSettingKey}: ${otherSettingValue}\`). This setting was probably explicitly set in your configuration. Sentry won't override this setting but it may affect source maps generation and upload. Without source maps, code snippets on the Sentry Issues page will remain minified.`
|
|
484
|
+
);
|
|
475
485
|
}
|
|
476
486
|
}
|
|
477
487
|
function logKeepEnabledSourceMapSetting(sentryNuxtModuleOptions, settingKey, settingValue) {
|
|
478
488
|
if (sentryNuxtModuleOptions.debug) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
);
|
|
483
|
-
});
|
|
489
|
+
console.log(
|
|
490
|
+
`[Sentry] \`${settingKey}\` is enabled with \`${settingValue}\`. This will correctly un-minify the code snippet on the Sentry Issue Details page.`
|
|
491
|
+
);
|
|
484
492
|
}
|
|
485
493
|
}
|
|
486
|
-
function warnExplicitlyDisabledSourceMap(settingKey) {
|
|
487
|
-
|
|
494
|
+
function warnExplicitlyDisabledSourceMap(settingKey, isDebug) {
|
|
495
|
+
if (isDebug) {
|
|
488
496
|
console.warn(
|
|
489
|
-
`[Sentry]
|
|
497
|
+
`[Sentry] Source map generation is currently disabled in your Vite configuration (\`${settingKey}: false \`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`).`
|
|
490
498
|
);
|
|
491
|
-
}
|
|
499
|
+
} else {
|
|
500
|
+
console.warn(`[Sentry] Source map generation (\`${settingKey}\`) is disabled in your Vite configuration.`);
|
|
501
|
+
}
|
|
492
502
|
}
|
|
493
503
|
function logSentryEnablesSourceMap(settingKey, settingValue) {
|
|
494
|
-
|
|
495
|
-
console.log(`[Sentry] Enabled source map generation in the build options with \`${settingKey}: ${settingValue}\`.`);
|
|
496
|
-
});
|
|
504
|
+
console.log(`[Sentry] Enabled source map generation in the build options with \`${settingKey}: ${settingValue}\`.`);
|
|
497
505
|
}
|
|
498
506
|
|
|
499
507
|
const module = defineNuxtModule({
|
|
@@ -13,8 +13,18 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
13
13
|
nitroApp.h3App.handler = patchEventHandler(nitroApp.h3App.handler);
|
|
14
14
|
nitroApp.hooks.hook("beforeResponse", updateRouteBeforeResponse);
|
|
15
15
|
nitroApp.hooks.hook("error", sentryCaptureErrorHook);
|
|
16
|
-
nitroApp.hooks.hook("render:html", (html) => {
|
|
17
|
-
|
|
16
|
+
nitroApp.hooks.hook("render:html", (html, { event }) => {
|
|
17
|
+
const headers = event.node.res?.getHeaders() || {};
|
|
18
|
+
const isPreRenderedPage = Object.keys(headers).includes("x-nitro-prerender");
|
|
19
|
+
const isSWRCachedPage = event?.context?.cache?.options.swr;
|
|
20
|
+
if (!isPreRenderedPage && !isSWRCachedPage) {
|
|
21
|
+
addSentryTracingMetaTags(html.head);
|
|
22
|
+
} else {
|
|
23
|
+
const reason = isPreRenderedPage ? "the page was pre-rendered" : "SWR caching is enabled for the route";
|
|
24
|
+
debug.log(
|
|
25
|
+
`Not adding Sentry tracing meta tags to HTML for ${event.path} because ${reason}. This will disable distributed tracing and prevent connecting multiple client page loads to the same server request.`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
18
28
|
});
|
|
19
29
|
});
|
|
20
30
|
function patchEventHandler(handler) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BuildTimeOptionsBase } from '@sentry/core';
|
|
1
2
|
import type { init as initNode } from '@sentry/node';
|
|
2
3
|
import type { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
|
|
3
4
|
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
|
|
@@ -22,6 +23,7 @@ type SourceMapsOptions = {
|
|
|
22
23
|
* Suppresses all logs.
|
|
23
24
|
*
|
|
24
25
|
* @default false
|
|
26
|
+
* @deprecated Use option `silent` instead of `sourceMapsUploadOptions.silent`
|
|
25
27
|
*/
|
|
26
28
|
silent?: boolean;
|
|
27
29
|
/**
|
|
@@ -38,12 +40,16 @@ type SourceMapsOptions = {
|
|
|
38
40
|
* console.warn(err);
|
|
39
41
|
* }
|
|
40
42
|
* ```
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use option `errorHandler` instead of `sourceMapsUploadOptions.errorHandler`
|
|
41
45
|
*/
|
|
42
46
|
errorHandler?: (err: Error) => void;
|
|
43
47
|
/**
|
|
44
48
|
* Options related to managing the Sentry releases for a build.
|
|
45
49
|
*
|
|
46
50
|
* More info: https://docs.sentry.io/product/releases/
|
|
51
|
+
*
|
|
52
|
+
* @deprecated Use option `release` instead of `sourceMapsUploadOptions.release`
|
|
47
53
|
*/
|
|
48
54
|
release?: {
|
|
49
55
|
/**
|
|
@@ -56,6 +62,8 @@ type SourceMapsOptions = {
|
|
|
56
62
|
* (the latter requires access to git CLI and for the root directory to be a valid repository)
|
|
57
63
|
*
|
|
58
64
|
* If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
|
|
65
|
+
*
|
|
66
|
+
* @deprecated Use `release.name` instead of `sourceMapsUploadOptions.release.name`
|
|
59
67
|
*/
|
|
60
68
|
name?: string;
|
|
61
69
|
};
|
|
@@ -64,6 +72,7 @@ type SourceMapsOptions = {
|
|
|
64
72
|
* automatically generate and upload source maps to Sentry during a production build.
|
|
65
73
|
*
|
|
66
74
|
* @default true
|
|
75
|
+
* @deprecated Use option `sourcemaps.disable` instead of `sourceMapsUploadOptions.enabled`
|
|
67
76
|
*/
|
|
68
77
|
enabled?: boolean;
|
|
69
78
|
/**
|
|
@@ -73,22 +82,27 @@ type SourceMapsOptions = {
|
|
|
73
82
|
*
|
|
74
83
|
* To create an auth token, follow this guide:
|
|
75
84
|
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
|
|
85
|
+
* @deprecated Use option `authToken` instead of `sourceMapsUploadOptions.authToken`
|
|
76
86
|
*/
|
|
77
87
|
authToken?: string;
|
|
78
88
|
/**
|
|
79
89
|
* The organization slug of your Sentry organization.
|
|
80
90
|
* Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
|
|
91
|
+
* @deprecated Use option `org` instead of `sourceMapsUploadOptions.org`
|
|
81
92
|
*/
|
|
82
93
|
org?: string;
|
|
83
94
|
/**
|
|
84
95
|
* The URL of your Sentry instance if you're using self-hosted Sentry.
|
|
85
96
|
*
|
|
86
97
|
* @default https://sentry.io by default the plugin will point towards the Sentry SaaS URL
|
|
98
|
+
* @deprecated Use `sentryUrl` instead of `sourceMapsUploadOptions.url`
|
|
87
99
|
*/
|
|
88
100
|
url?: string;
|
|
89
101
|
/**
|
|
90
102
|
* The project slug of your Sentry project.
|
|
91
103
|
* Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated Use option `project` instead of `sourceMapsUploadOptions.project`
|
|
92
106
|
*/
|
|
93
107
|
project?: string;
|
|
94
108
|
/**
|
|
@@ -96,10 +110,13 @@ type SourceMapsOptions = {
|
|
|
96
110
|
* It will not collect any sensitive or user-specific data.
|
|
97
111
|
*
|
|
98
112
|
* @default true
|
|
113
|
+
* @deprecated Use option `telemetry` instead of `sourceMapsUploadOptions.telemetry`
|
|
99
114
|
*/
|
|
100
115
|
telemetry?: boolean;
|
|
101
116
|
/**
|
|
102
117
|
* Options related to sourcemaps
|
|
118
|
+
*
|
|
119
|
+
* @deprecated Use option `sourcemaps` instead of `sourceMapsUploadOptions.sourcemaps`
|
|
103
120
|
*/
|
|
104
121
|
sourcemaps?: {
|
|
105
122
|
/**
|
|
@@ -111,6 +128,8 @@ type SourceMapsOptions = {
|
|
|
111
128
|
*
|
|
112
129
|
* The globbing patterns must follow the implementation of the `glob` package.
|
|
113
130
|
* @see https://www.npmjs.com/package/glob#glob-primer
|
|
131
|
+
*
|
|
132
|
+
* @deprecated Use option `sourcemaps.assets` instead of `sourceMapsUploadOptions.sourcemaps.assets`
|
|
114
133
|
*/
|
|
115
134
|
assets?: string | Array<string>;
|
|
116
135
|
/**
|
|
@@ -120,6 +139,8 @@ type SourceMapsOptions = {
|
|
|
120
139
|
* or the default value for `assets` are uploaded.
|
|
121
140
|
*
|
|
122
141
|
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
142
|
+
*
|
|
143
|
+
* @deprecated Use option `sourcemaps.ignore` instead of `sourceMapsUploadOptions.sourcemaps.ignore`
|
|
123
144
|
*/
|
|
124
145
|
ignore?: string | Array<string>;
|
|
125
146
|
/**
|
|
@@ -129,6 +150,8 @@ type SourceMapsOptions = {
|
|
|
129
150
|
* @default [] - By default no files are deleted.
|
|
130
151
|
*
|
|
131
152
|
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
|
|
153
|
+
*
|
|
154
|
+
* @deprecated Use option `sourcemaps.filesToDeleteAfterUpload` instead of `sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload`
|
|
132
155
|
*/
|
|
133
156
|
filesToDeleteAfterUpload?: string | Array<string>;
|
|
134
157
|
};
|
|
@@ -136,7 +159,7 @@ type SourceMapsOptions = {
|
|
|
136
159
|
/**
|
|
137
160
|
* Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
|
|
138
161
|
*/
|
|
139
|
-
export type SentryNuxtModuleOptions = {
|
|
162
|
+
export type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
|
|
140
163
|
/**
|
|
141
164
|
* Enable the Sentry Nuxt Module.
|
|
142
165
|
*
|
|
@@ -148,13 +171,11 @@ export type SentryNuxtModuleOptions = {
|
|
|
148
171
|
*
|
|
149
172
|
* These options are always read from the `sentry` module options in the `nuxt.config.(js|ts).
|
|
150
173
|
* Do not define them in the `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.
|
|
174
|
+
*
|
|
175
|
+
* @deprecated This option was deprecated as it adds unnecessary nesting.
|
|
176
|
+
* Put the options one level higher to the root-level of the `sentry` module options.
|
|
151
177
|
*/
|
|
152
178
|
sourceMapsUploadOptions?: SourceMapsOptions;
|
|
153
|
-
/**
|
|
154
|
-
* Enable debug functionality of the SDK during build-time.
|
|
155
|
-
* Enabling this will give you, for example, logs about source maps.
|
|
156
|
-
*/
|
|
157
|
-
debug?: boolean;
|
|
158
179
|
/**
|
|
159
180
|
*
|
|
160
181
|
* Enables (partial) server tracing by automatically injecting Sentry for environments where modifying the node option `--import` is not possible.
|
|
@@ -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;AAInD,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,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG;IACrE;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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;;;;;;;WAWG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;;;WASG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;;;WASG;QACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KACnD,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG;IAC3D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;OAQG;IACH,uBAAuB,CAAC,EAAE,iBAAiB,CAAC;IAE5C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,sBAAsB,CAAC,EAAE,kBAAkB,GAAG,6BAA6B,CAAC;IAE5E;;;;;;;;;;OAUG;IACH,uCAAuC,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnD;;;;;OAKG;IACH,mCAAmC,CAAC,EAAE,yBAAyB,GAAG,uBAAuB,CAAC;CAC3F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.server.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.server.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"sentry.server.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.server.ts"],"names":[],"mappings":";AAeA,wBAwBG"}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"sourceMaps.d.ts","sourceRoot":"","sources":["../../../src/vite/sourceMaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,c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AgB,8BAA8B,CAC5C,IAAI,EAAE;IAAE,OAAO,EAAE;QAAE,SAAS,CAAC,EAAE,gBAAgB,GAAG;YAAE,MAAM,CAAC,EAAE,gBAAgB,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,EACnF,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAsCN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/nuxt",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.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",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@nuxt/kit": "^3.13.2",
|
|
50
|
-
"@sentry/browser": "10.
|
|
51
|
-
"@sentry/cloudflare": "10.
|
|
52
|
-
"@sentry/core": "10.
|
|
53
|
-
"@sentry/node": "10.
|
|
54
|
-
"@sentry/rollup-plugin": "^4.0.
|
|
50
|
+
"@sentry/browser": "10.2.0",
|
|
51
|
+
"@sentry/cloudflare": "10.2.0",
|
|
52
|
+
"@sentry/core": "10.2.0",
|
|
53
|
+
"@sentry/node": "10.2.0",
|
|
54
|
+
"@sentry/rollup-plugin": "^4.0.2",
|
|
55
55
|
"@sentry/vite-plugin": "^4.0.0",
|
|
56
|
-
"@sentry/vue": "10.
|
|
56
|
+
"@sentry/vue": "10.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@nuxt/module-builder": "^0.8.4",
|