@sentry/nuxt 10.53.1 → 10.54.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.
Files changed (66) hide show
  1. package/build/cjs/client/piniaIntegration.js +7 -19
  2. package/build/cjs/client/piniaIntegration.js.map +1 -1
  3. package/build/cjs/client/sdk.js +2 -9
  4. package/build/cjs/client/sdk.js.map +1 -1
  5. package/build/cjs/client/vueIntegration.js +3 -10
  6. package/build/cjs/client/vueIntegration.js.map +1 -1
  7. package/build/cjs/common/debug-build.js +0 -5
  8. package/build/cjs/common/debug-build.js.map +1 -1
  9. package/build/cjs/module.js +52 -107
  10. package/build/cjs/module.js.map +1 -1
  11. package/build/cjs/server/sdk.js +20 -60
  12. package/build/cjs/server/sdk.js.map +1 -1
  13. package/build/cjs/vendor/server-template.js +0 -6
  14. package/build/cjs/vendor/server-template.js.map +1 -1
  15. package/build/cjs/vite/addServerConfig.js +45 -144
  16. package/build/cjs/vite/addServerConfig.js.map +1 -1
  17. package/build/cjs/vite/databaseConfig.js +10 -32
  18. package/build/cjs/vite/databaseConfig.js.map +1 -1
  19. package/build/cjs/vite/middlewareConfig.js +11 -46
  20. package/build/cjs/vite/middlewareConfig.js.map +1 -1
  21. package/build/cjs/vite/sentryVitePlugin.js +7 -24
  22. package/build/cjs/vite/sentryVitePlugin.js.map +1 -1
  23. package/build/cjs/vite/sourceMaps.js +89 -248
  24. package/build/cjs/vite/sourceMaps.js.map +1 -1
  25. package/build/cjs/vite/storageConfig.js +4 -10
  26. package/build/cjs/vite/storageConfig.js.map +1 -1
  27. package/build/cjs/vite/utils.js +51 -143
  28. package/build/cjs/vite/utils.js.map +1 -1
  29. package/build/esm/client/piniaIntegration.js +7 -19
  30. package/build/esm/client/piniaIntegration.js.map +1 -1
  31. package/build/esm/client/sdk.js +2 -9
  32. package/build/esm/client/sdk.js.map +1 -1
  33. package/build/esm/client/vueIntegration.js +3 -10
  34. package/build/esm/client/vueIntegration.js.map +1 -1
  35. package/build/esm/common/debug-build.js +0 -5
  36. package/build/esm/common/debug-build.js.map +1 -1
  37. package/build/esm/module.js +52 -107
  38. package/build/esm/module.js.map +1 -1
  39. package/build/esm/package.json +1 -1
  40. package/build/esm/server/sdk.js +20 -60
  41. package/build/esm/server/sdk.js.map +1 -1
  42. package/build/esm/vendor/server-template.js +0 -6
  43. package/build/esm/vendor/server-template.js.map +1 -1
  44. package/build/esm/vite/addServerConfig.js +45 -144
  45. package/build/esm/vite/addServerConfig.js.map +1 -1
  46. package/build/esm/vite/databaseConfig.js +10 -32
  47. package/build/esm/vite/databaseConfig.js.map +1 -1
  48. package/build/esm/vite/middlewareConfig.js +11 -46
  49. package/build/esm/vite/middlewareConfig.js.map +1 -1
  50. package/build/esm/vite/sentryVitePlugin.js +7 -24
  51. package/build/esm/vite/sentryVitePlugin.js.map +1 -1
  52. package/build/esm/vite/sourceMaps.js +89 -248
  53. package/build/esm/vite/sourceMaps.js.map +1 -1
  54. package/build/esm/vite/storageConfig.js +4 -10
  55. package/build/esm/vite/storageConfig.js.map +1 -1
  56. package/build/esm/vite/utils.js +51 -143
  57. package/build/esm/vite/utils.js.map +1 -1
  58. package/build/module/module.d.mts +17 -0
  59. package/build/module/module.d.ts +17 -0
  60. package/build/module/module.json +1 -1
  61. package/build/module/module.mjs +6 -6
  62. package/build/types/common/types.d.ts +17 -0
  63. package/build/types/common/types.d.ts.map +1 -1
  64. package/build/types/vite/utils.d.ts +2 -1
  65. package/build/types/vite/utils.d.ts.map +1 -1
  66. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"sentryVitePlugin.js","sources":["../../../src/vite/sentryVitePlugin.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport type { ConfigEnv, Plugin, UserConfig } from 'vite';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport { extractNuxtSourceMapSetting, validateDifferentSourceMapSettings } from './sourceMaps';\n\n/**\n * Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.\n */\nexport function validateSourceMapsOptionsPlugin(options: {\n nuxt: Nuxt;\n moduleOptions: SentryNuxtModuleOptions;\n sourceMapsEnabled: boolean;\n}): Plugin {\n const { nuxt, moduleOptions, sourceMapsEnabled } = options;\n const isDebug = moduleOptions.debug;\n\n return {\n name: 'sentry-nuxt-source-map-validation',\n config(viteConfig: UserConfig, env: ConfigEnv) {\n // Only run in production builds\n if (!sourceMapsEnabled || env.mode === 'development' || nuxt.options?._prepare) {\n return;\n }\n\n // Detect runtime from Vite config\n // In Nuxt, SSR builds have build.ssr: true, client builds don't\n const runtime = viteConfig.build?.ssr ? 'server' : 'client';\n\n const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);\n\n // Initialize build config if needed\n viteConfig.build = viteConfig.build || {};\n const viteSourceMap = viteConfig.build.sourcemap;\n\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Validating Vite config for the ${runtime} runtime.`);\n }\n\n // Vite source map options are the same as the Nuxt source map config options (unless overwritten)\n validateDifferentSourceMapSettings({\n nuxtSettingKey: `sourcemap.${runtime}`,\n nuxtSettingValue: nuxtSourceMapSetting,\n otherSettingKey: 'viteConfig.build.sourcemap',\n otherSettingValue: viteSourceMap,\n });\n },\n };\n}\n"],"names":[],"mappings":";;AAKA;AACA;AACA;AACO,SAAS,+BAA+B,CAAC;;AAIhD,EAAW;AACX,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAA,EAAkB,GAAI,OAAO;AAC5D,EAAE,MAAM,OAAA,GAAU,aAAa,CAAC,KAAK;;AAErC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,mCAAmC;AAC7C,IAAI,MAAM,CAAC,UAAU,EAAc,GAAG,EAAa;AACnD;AACA,MAAM,IAAI,CAAC,iBAAA,IAAqB,GAAG,CAAC,IAAA,KAAS,aAAA,IAAiB,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE;AACtF,QAAQ;AACR,MAAM;;AAEN;AACA;AACA,MAAM,MAAM,OAAA,GAAU,UAAU,CAAC,KAAK,EAAE,GAAA,GAAM,QAAA,GAAW,QAAQ;;AAEjE,MAAM,MAAM,uBAAuB,2BAA2B,CAAC,IAAI,EAAE,OAAO,CAAC;;AAE7E;AACA,MAAM,UAAU,CAAC,KAAA,GAAQ,UAAU,CAAC,KAAA,IAAS,EAAE;AAC/C,MAAM,MAAM,aAAA,GAAgB,UAAU,CAAC,KAAK,CAAC,SAAS;;AAEtD,MAAM,IAAI,OAAO,EAAE;AACnB;AACA,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,wCAAwC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;AAClF,MAAM;;AAEN;AACA,MAAM,kCAAkC,CAAC;AACzC,QAAQ,cAAc,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;AACA,QAAA,gBAAA,EAAA,oBAAA;AACA,QAAA,eAAA,EAAA,4BAAA;AACA,QAAA,iBAAA,EAAA,aAAA;AACA,OAAA,CAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA;;;;"}
1
+ {"version":3,"file":"sentryVitePlugin.js","sources":["../../../src/vite/sentryVitePlugin.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport type { ConfigEnv, Plugin, UserConfig } from 'vite';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport { extractNuxtSourceMapSetting, validateDifferentSourceMapSettings } from './sourceMaps';\n\n/**\n * Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.\n */\nexport function validateSourceMapsOptionsPlugin(options: {\n nuxt: Nuxt;\n moduleOptions: SentryNuxtModuleOptions;\n sourceMapsEnabled: boolean;\n}): Plugin {\n const { nuxt, moduleOptions, sourceMapsEnabled } = options;\n const isDebug = moduleOptions.debug;\n\n return {\n name: 'sentry-nuxt-source-map-validation',\n config(viteConfig: UserConfig, env: ConfigEnv) {\n // Only run in production builds\n if (!sourceMapsEnabled || env.mode === 'development' || nuxt.options?._prepare) {\n return;\n }\n\n // Detect runtime from Vite config\n // In Nuxt, SSR builds have build.ssr: true, client builds don't\n const runtime = viteConfig.build?.ssr ? 'server' : 'client';\n\n const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);\n\n // Initialize build config if needed\n viteConfig.build = viteConfig.build || {};\n const viteSourceMap = viteConfig.build.sourcemap;\n\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Validating Vite config for the ${runtime} runtime.`);\n }\n\n // Vite source map options are the same as the Nuxt source map config options (unless overwritten)\n validateDifferentSourceMapSettings({\n nuxtSettingKey: `sourcemap.${runtime}`,\n nuxtSettingValue: nuxtSourceMapSetting,\n otherSettingKey: 'viteConfig.build.sourcemap',\n otherSettingValue: viteSourceMap,\n });\n },\n };\n}\n"],"names":[],"mappings":";;AAQO,SAAS,gCAAgC,OAAA,EAIrC;AACT,EAAA,MAAM,EAAE,IAAA,EAAM,aAAA,EAAe,iBAAA,EAAkB,GAAI,OAAA;AACnD,EAAA,MAAM,UAAU,aAAA,CAAc,KAAA;AAE9B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,mCAAA;AAAA,IACN,MAAA,CAAO,YAAwB,GAAA,EAAgB;AAE7C,MAAA,IAAI,CAAC,iBAAA,IAAqB,GAAA,CAAI,SAAS,aAAA,IAAiB,IAAA,CAAK,SAAS,QAAA,EAAU;AAC9E,QAAA;AAAA,MACF;AAIA,MAAA,MAAM,OAAA,GAAU,UAAA,CAAW,KAAA,EAAO,GAAA,GAAM,QAAA,GAAW,QAAA;AAEnD,MAAA,MAAM,oBAAA,GAAuB,2BAAA,CAA4B,IAAA,EAAM,OAAO,CAAA;AAGtE,MAAA,UAAA,CAAW,KAAA,GAAQ,UAAA,CAAW,KAAA,IAAS,EAAC;AACxC,MAAA,MAAM,aAAA,GAAgB,WAAW,KAAA,CAAM,SAAA;AAEvC,MAAA,IAAI,OAAA,EAAS;AAEX,QAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,wCAAA,EAA2C,OAAO,CAAA,SAAA,CAAW,CAAA;AAAA,MAC3E;AAGA,MAAA,kCAAA,CAAmC;AAAA,QACjC,cAAA,EAAgB,aAAa,OAAO,CAAA,CAAA;AAAA,QACpC,gBAAA,EAAkB,oBAAA;AAAA,QAClB,eAAA,EAAiB,4BAAA;AAAA,QACjB,iBAAA,EAAmB;AAAA,OACpB,CAAA;AAAA,IACH;AAAA,GACF;AACF;;;;"}
@@ -2,166 +2,84 @@ import { sentryRollupPlugin } from '@sentry/rollup-plugin';
2
2
  import { sentryVitePlugin } from '@sentry/vite-plugin';
3
3
  import { validateSourceMapsOptionsPlugin } from './sentryVitePlugin.js';
4
4
 
5
- /**
6
- * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps
7
- */
8
-
9
- /**
10
- * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).
11
- */
12
- function setupSourceMaps(
13
- moduleOptions,
14
- nuxt,
15
- addVitePlugin,
16
- ) {
17
- // TODO(v11): remove deprecated options (also from SentryNuxtModuleOptions type)
18
-
5
+ function setupSourceMaps(moduleOptions, nuxt, addVitePlugin) {
19
6
  const isDebug = moduleOptions.debug;
20
-
21
- // eslint-disable-next-line deprecation/deprecation
22
7
  const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
23
-
24
- const sourceMapsEnabled =
25
- moduleOptions.sourcemaps?.disable === true
26
- ? false
27
- : moduleOptions.sourcemaps?.disable === false
28
- ? true
29
- : // eslint-disable-next-line deprecation/deprecation
30
- (sourceMapsUploadOptions.enabled ?? true);
31
-
32
- // In case we overwrite the source map settings, we default to deleting the files
8
+ const sourceMapsEnabled = moduleOptions.sourcemaps?.disable === true ? false : moduleOptions.sourcemaps?.disable === false ? true : (
9
+ // eslint-disable-next-line deprecation/deprecation
10
+ sourceMapsUploadOptions.enabled ?? true
11
+ );
33
12
  const shouldDeleteFilesFallback = { client: true, server: true };
34
-
35
- nuxt.hook('modules:done', () => {
13
+ nuxt.hook("modules:done", () => {
36
14
  if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) {
37
- // Changing this setting will propagate:
38
- // - for client to viteConfig.build.sourceMap
39
- // - for server to viteConfig.build.sourceMap and nitro.sourceMap
40
- // On server, nitro.rollupConfig.output.sourcemap remains unaffected from this change.
41
-
42
- // ONLY THIS nuxt.sourcemap.(server/client) setting is the one Sentry will overwrite with 'hidden', if needed.
43
15
  const previousSourceMapSettings = changeNuxtSourceMapSettings(nuxt, moduleOptions);
44
-
45
- // Mutate in place so the Vite plugin (which captured this object at registration time) sees the updated values
46
- shouldDeleteFilesFallback.client = previousSourceMapSettings.client === 'unset';
47
- shouldDeleteFilesFallback.server = previousSourceMapSettings.server === 'unset';
48
-
16
+ shouldDeleteFilesFallback.client = previousSourceMapSettings.client === "unset";
17
+ shouldDeleteFilesFallback.server = previousSourceMapSettings.server === "unset";
49
18
  if (isDebug && (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)) {
50
- const enabledDeleteFallbacks =
51
- shouldDeleteFilesFallback.client && shouldDeleteFilesFallback.server
52
- ? 'client-side and server-side'
53
- : shouldDeleteFilesFallback.server
54
- ? 'server-side'
55
- : 'client-side';
56
-
57
- if (
58
- !moduleOptions.sourcemaps?.filesToDeleteAfterUpload &&
59
- // eslint-disable-next-line deprecation/deprecation
60
- !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload
61
- ) {
62
- // eslint-disable-next-line no-console
19
+ const enabledDeleteFallbacks = shouldDeleteFilesFallback.client && shouldDeleteFilesFallback.server ? "client-side and server-side" : shouldDeleteFilesFallback.server ? "server-side" : "client-side";
20
+ if (!moduleOptions.sourcemaps?.filesToDeleteAfterUpload && // eslint-disable-next-line deprecation/deprecation
21
+ !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload) {
63
22
  console.log(
64
- `[Sentry] We enabled \`'hidden'\` source maps for your ${enabledDeleteFallbacks} build. Source map files will be automatically deleted after uploading them to Sentry.`,
23
+ `[Sentry] We enabled \`'hidden'\` source maps for your ${enabledDeleteFallbacks} build. Source map files will be automatically deleted after uploading them to Sentry.`
65
24
  );
66
25
  } else {
67
- // eslint-disable-next-line no-console
68
26
  console.log(
69
- `[Sentry] We enabled \`'hidden'\` source maps for your ${enabledDeleteFallbacks} build. Source map files will be deleted according to your \`sourcemaps.filesToDeleteAfterUpload\` configuration. To use automatic deletion instead, leave \`filesToDeleteAfterUpload\` empty.`,
27
+ `[Sentry] We enabled \`'hidden'\` source maps for your ${enabledDeleteFallbacks} build. Source map files will be deleted according to your \`sourcemaps.filesToDeleteAfterUpload\` configuration. To use automatic deletion instead, leave \`filesToDeleteAfterUpload\` empty.`
70
28
  );
71
29
  }
72
30
  }
73
31
  }
74
32
  });
75
-
76
33
  if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) {
77
34
  addVitePlugin(
78
35
  [
79
36
  validateSourceMapsOptionsPlugin({ nuxt, moduleOptions, sourceMapsEnabled }),
80
37
  // Vite plugin is added on the client and server side (plugin runs for both builds)
81
- ...sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)),
38
+ ...sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback))
82
39
  ],
83
- { dev: false, build: true }, // Only add source map plugin during build
40
+ { dev: false, build: true }
41
+ // Only add source map plugin during build
84
42
  );
85
43
  }
86
-
87
- nuxt.hook('nitro:config', (nitroConfig) => {
44
+ nuxt.hook("nitro:config", (nitroConfig) => {
88
45
  if (sourceMapsEnabled && !nitroConfig.dev && !nuxt.options?._prepare) {
89
46
  if (!nitroConfig.rollupConfig) {
90
47
  nitroConfig.rollupConfig = {};
91
48
  }
92
-
93
- if (nitroConfig.rollupConfig.plugins === null || nitroConfig.rollupConfig.plugins === undefined) {
49
+ if (nitroConfig.rollupConfig.plugins === null || nitroConfig.rollupConfig.plugins === void 0) {
94
50
  nitroConfig.rollupConfig.plugins = [];
95
51
  } else if (!Array.isArray(nitroConfig.rollupConfig.plugins)) {
96
- // `rollupConfig.plugins` can be a single plugin, so we want to put it into an array so that we can push our own plugin
97
52
  nitroConfig.rollupConfig.plugins = [nitroConfig.rollupConfig.plugins];
98
53
  }
99
-
100
54
  validateNitroSourceMapSettings(nuxt, nitroConfig, moduleOptions);
101
-
102
55
  if (isDebug) {
103
- // eslint-disable-next-line no-console
104
- console.log('[Sentry] Adding Sentry Rollup plugin to the server runtime.');
56
+ console.log("[Sentry] Adding Sentry Rollup plugin to the server runtime.");
105
57
  }
106
-
107
- // Add Sentry plugin
108
- // Runs only on server-side (Nitro)
109
58
  nitroConfig.rollupConfig.plugins.push(
110
- sentryRollupPlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)),
59
+ sentryRollupPlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback))
111
60
  );
112
61
  }
113
62
  });
114
63
  }
115
-
116
- /**
117
- * Normalizes the beginning of a path from e.g. ../../../ to ./
118
- */
119
64
  function normalizePath(path) {
120
- return path.replace(/^(\.\.\/)+/, './');
65
+ return path.replace(/^(\.\.\/)+/, "./");
121
66
  }
122
-
123
- /**
124
- * Generates source maps upload options for the Sentry Vite and Rollup plugin.
125
- *
126
- * Only exported for Testing purposes.
127
- */
128
- // todo(v11): This "eslint-disable" can be removed again once we remove deprecated options.
129
- // eslint-disable-next-line complexity
130
- function getPluginOptions(
131
- moduleOptions,
132
- shouldDeleteFilesFallback,
133
- ) {
134
- // eslint-disable-next-line deprecation/deprecation
67
+ function getPluginOptions(moduleOptions, shouldDeleteFilesFallback) {
135
68
  const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
136
-
137
69
  const shouldDeleteFilesAfterUpload = shouldDeleteFilesFallback?.client || shouldDeleteFilesFallback?.server;
138
70
  const fallbackFilesToDelete = [
139
- ...(shouldDeleteFilesFallback?.client ? ['.*/**/public/**/*.map'] : []),
140
- ...(shouldDeleteFilesFallback?.server
141
- ? ['.*/**/server/**/*.map', '.*/**/output/**/*.map', '.*/**/function/**/*.map']
142
- : []),
71
+ ...shouldDeleteFilesFallback?.client ? [".*/**/public/**/*.map"] : [],
72
+ ...shouldDeleteFilesFallback?.server ? [".*/**/server/**/*.map", ".*/**/output/**/*.map", ".*/**/function/**/*.map"] : []
143
73
  ];
144
-
145
- // Check for filesToDeleteAfterUpload in new location first, then deprecated location
146
74
  const sourcemapsOptions = moduleOptions.sourcemaps || {};
147
- // eslint-disable-next-line deprecation/deprecation
148
75
  const deprecatedSourcemapsOptions = sourceMapsUploadOptions.sourcemaps || {};
149
-
150
- const filesToDeleteAfterUpload =
151
- sourcemapsOptions.filesToDeleteAfterUpload ??
152
- // eslint-disable-next-line deprecation/deprecation
153
- deprecatedSourcemapsOptions.filesToDeleteAfterUpload;
154
-
155
- if (typeof filesToDeleteAfterUpload === 'undefined' && shouldDeleteFilesAfterUpload && moduleOptions.debug) {
156
- // eslint-disable-next-line no-console
76
+ const filesToDeleteAfterUpload = sourcemapsOptions.filesToDeleteAfterUpload ?? // eslint-disable-next-line deprecation/deprecation
77
+ deprecatedSourcemapsOptions.filesToDeleteAfterUpload;
78
+ if (typeof filesToDeleteAfterUpload === "undefined" && shouldDeleteFilesAfterUpload && moduleOptions.debug) {
157
79
  console.log(
158
- `[Sentry] Setting \`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete
159
- // Logging it as strings in the array
160
- .map(path => `"${path}"`)
161
- .join(', ')}]\` to delete generated source maps after they were uploaded to Sentry.`,
80
+ `[Sentry] Setting \`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete.map((path) => `"${path}"`).join(", ")}]\` to delete generated source maps after they were uploaded to Sentry.`
162
81
  );
163
82
  }
164
-
165
83
  return {
166
84
  applicationKey: moduleOptions.applicationKey,
167
85
  // eslint-disable-next-line deprecation/deprecation
@@ -180,229 +98,152 @@ function getPluginOptions(
180
98
  silent: moduleOptions.silent ?? sourceMapsUploadOptions.silent ?? false,
181
99
  // eslint-disable-next-line deprecation/deprecation
182
100
  errorHandler: moduleOptions.errorHandler ?? sourceMapsUploadOptions.errorHandler,
183
- bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations, // todo: test if this can be overridden by the user
101
+ bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations,
102
+ // todo: test if this can be overridden by the user
184
103
  release: {
185
104
  // eslint-disable-next-line deprecation/deprecation
186
105
  name: moduleOptions.release?.name ?? sourceMapsUploadOptions.release?.name,
187
106
  // Support all release options from BuildTimeOptionsBase
188
107
  ...moduleOptions.release,
189
- ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,
108
+ ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release
190
109
  },
191
110
  _metaOptions: {
192
111
  telemetry: {
193
- metaFramework: 'nuxt',
194
- },
112
+ metaFramework: "nuxt"
113
+ }
195
114
  },
196
115
  ...moduleOptions?.unstable_sentryBundlerPluginOptions,
197
-
198
116
  sourcemaps: {
199
117
  disable: moduleOptions.sourcemaps?.disable,
200
118
  // The server/client files are in different places depending on the nitro preset (e.g. '.output/server' or '.netlify/functions-internal/server')
201
119
  // 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).
202
120
  // 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/**/*'],
203
121
  // eslint-disable-next-line deprecation/deprecation
204
- assets: sourcemapsOptions.assets ?? deprecatedSourcemapsOptions.assets ?? undefined,
122
+ assets: sourcemapsOptions.assets ?? deprecatedSourcemapsOptions.assets ?? void 0,
205
123
  // eslint-disable-next-line deprecation/deprecation
206
- ignore: sourcemapsOptions.ignore ?? deprecatedSourcemapsOptions.ignore ?? undefined,
207
- filesToDeleteAfterUpload: filesToDeleteAfterUpload
208
- ? filesToDeleteAfterUpload
209
- : shouldDeleteFilesFallback?.server || shouldDeleteFilesFallback?.client
210
- ? fallbackFilesToDelete
211
- : undefined,
124
+ ignore: sourcemapsOptions.ignore ?? deprecatedSourcemapsOptions.ignore ?? void 0,
125
+ filesToDeleteAfterUpload: filesToDeleteAfterUpload ? filesToDeleteAfterUpload : shouldDeleteFilesFallback?.server || shouldDeleteFilesFallback?.client ? fallbackFilesToDelete : void 0,
212
126
  rewriteSources: sourcemapsOptions.rewriteSources ?? normalizePath,
213
- ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,
214
- },
127
+ ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps
128
+ }
215
129
  };
216
130
  }
217
-
218
- /* There are multiple ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993 and https://github.com/getsentry/sentry-javascript/pull/15859)
219
- 1. User explicitly disabled source maps
220
- - keep this setting (emit a warning that errors won't be unminified in Sentry)
221
- - We will not upload anything
222
- 2. users enabled source map generation (true, hidden, inline).
223
- - keep this setting (don't do anything - like deletion - besides uploading)
224
- 3. users did not set source maps generation
225
- - we enable 'hidden' source maps generation
226
- - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)
227
-
228
- Users only have to explicitly enable client source maps. Sentry only overwrites the base Nuxt source map settings as they propagate.
229
- */
230
-
231
- /** only exported for tests */
232
- function extractNuxtSourceMapSetting(
233
- nuxt,
234
- runtime,
235
- ) {
131
+ function extractNuxtSourceMapSetting(nuxt, runtime) {
236
132
  if (!runtime) {
237
- return undefined;
133
+ return void 0;
238
134
  } else {
239
- return typeof nuxt.options?.sourcemap === 'boolean' || typeof nuxt.options?.sourcemap === 'string'
240
- ? nuxt.options.sourcemap
241
- : nuxt.options?.sourcemap?.[runtime];
135
+ return typeof nuxt.options?.sourcemap === "boolean" || typeof nuxt.options?.sourcemap === "string" ? nuxt.options.sourcemap : nuxt.options?.sourcemap?.[runtime];
242
136
  }
243
137
  }
244
-
245
- /** only exported for testing */
246
- function changeNuxtSourceMapSettings(
247
- nuxt,
248
- sentryModuleOptions,
249
- ) {
250
- nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: undefined, client: undefined };
251
-
138
+ function changeNuxtSourceMapSettings(nuxt, sentryModuleOptions) {
139
+ nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: void 0, client: void 0 };
252
140
  let previousUserSourceMapSetting = {
253
- client: undefined,
254
- server: undefined,
141
+ client: void 0,
142
+ server: void 0
255
143
  };
256
-
257
144
  const nuxtSourceMap = nuxt.options.sourcemap;
258
145
  const isDebug = sentryModuleOptions.debug;
259
-
260
- if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {
146
+ if (typeof nuxtSourceMap === "string" || typeof nuxtSourceMap === "boolean" || typeof nuxtSourceMap === "undefined") {
261
147
  switch (nuxtSourceMap) {
262
148
  case false:
263
- warnExplicitlyDisabledSourceMap('sourcemap', isDebug);
264
- previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };
149
+ warnExplicitlyDisabledSourceMap("sourcemap", isDebug);
150
+ previousUserSourceMapSetting = { client: "disabled", server: "disabled" };
265
151
  break;
266
-
267
- case 'hidden':
152
+ case "hidden":
268
153
  case true:
269
- logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap', (nuxtSourceMap ).toString());
270
- previousUserSourceMapSetting = { client: 'enabled', server: 'enabled' };
154
+ logKeepEnabledSourceMapSetting(sentryModuleOptions, "sourcemap", nuxtSourceMap.toString());
155
+ previousUserSourceMapSetting = { client: "enabled", server: "enabled" };
271
156
  break;
272
- case undefined:
273
- nuxt.options.sourcemap = { server: 'hidden', client: 'hidden' };
274
- isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');
275
- isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');
276
- previousUserSourceMapSetting = { client: 'unset', server: 'unset' };
157
+ case void 0:
158
+ nuxt.options.sourcemap = { server: "hidden", client: "hidden" };
159
+ isDebug && logSentryEnablesSourceMap("sourcemap.client", "hidden");
160
+ isDebug && logSentryEnablesSourceMap("sourcemap.server", "hidden");
161
+ previousUserSourceMapSetting = { client: "unset", server: "unset" };
277
162
  break;
278
163
  }
279
164
  } else {
280
165
  if (nuxtSourceMap.client === false) {
281
- warnExplicitlyDisabledSourceMap('sourcemap.client', isDebug);
282
- previousUserSourceMapSetting.client = 'disabled';
283
- } else if (['hidden', true].includes(nuxtSourceMap.client)) {
284
- logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());
285
- previousUserSourceMapSetting.client = 'enabled';
166
+ warnExplicitlyDisabledSourceMap("sourcemap.client", isDebug);
167
+ previousUserSourceMapSetting.client = "disabled";
168
+ } else if (["hidden", true].includes(nuxtSourceMap.client)) {
169
+ logKeepEnabledSourceMapSetting(sentryModuleOptions, "sourcemap.client", nuxtSourceMap.client.toString());
170
+ previousUserSourceMapSetting.client = "enabled";
286
171
  } else {
287
- nuxt.options.sourcemap.client = 'hidden';
288
- isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');
289
- previousUserSourceMapSetting.client = 'unset';
172
+ nuxt.options.sourcemap.client = "hidden";
173
+ isDebug && logSentryEnablesSourceMap("sourcemap.client", "hidden");
174
+ previousUserSourceMapSetting.client = "unset";
290
175
  }
291
-
292
176
  if (nuxtSourceMap.server === false) {
293
- warnExplicitlyDisabledSourceMap('sourcemap.server', isDebug);
294
- previousUserSourceMapSetting.server = 'disabled';
295
- } else if (['hidden', true].includes(nuxtSourceMap.server)) {
296
- logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());
297
- previousUserSourceMapSetting.server = 'enabled';
177
+ warnExplicitlyDisabledSourceMap("sourcemap.server", isDebug);
178
+ previousUserSourceMapSetting.server = "disabled";
179
+ } else if (["hidden", true].includes(nuxtSourceMap.server)) {
180
+ logKeepEnabledSourceMapSetting(sentryModuleOptions, "sourcemap.server", nuxtSourceMap.server.toString());
181
+ previousUserSourceMapSetting.server = "enabled";
298
182
  } else {
299
- nuxt.options.sourcemap.server = 'hidden';
300
- isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');
301
- previousUserSourceMapSetting.server = 'unset';
183
+ nuxt.options.sourcemap.server = "hidden";
184
+ isDebug && logSentryEnablesSourceMap("sourcemap.server", "hidden");
185
+ previousUserSourceMapSetting.server = "unset";
302
186
  }
303
187
  }
304
-
305
188
  return previousUserSourceMapSetting;
306
189
  }
307
-
308
- /** Logs warnings about potentially conflicting source map settings.
309
- * Configures `sourcemapExcludeSources` in Nitro to make source maps usable in Sentry.
310
- *
311
- * only exported for testing
312
- */
313
- function validateNitroSourceMapSettings(
314
- nuxt,
315
- nitroConfig,
316
- sentryModuleOptions,
317
- ) {
190
+ function validateNitroSourceMapSettings(nuxt, nitroConfig, sentryModuleOptions) {
318
191
  const isDebug = sentryModuleOptions.debug;
319
- const nuxtSourceMap = extractNuxtSourceMapSetting(nuxt, 'server');
320
-
321
- // NITRO CONFIG ---
322
-
192
+ const nuxtSourceMap = extractNuxtSourceMapSetting(nuxt, "server");
323
193
  validateDifferentSourceMapSettings({
324
- nuxtSettingKey: 'sourcemap.server',
194
+ nuxtSettingKey: "sourcemap.server",
325
195
  nuxtSettingValue: nuxtSourceMap,
326
- otherSettingKey: 'nitro.sourceMap',
327
- otherSettingValue: nitroConfig.sourceMap,
196
+ otherSettingKey: "nitro.sourceMap",
197
+ otherSettingValue: nitroConfig.sourceMap
328
198
  });
329
-
330
- // ROLLUP CONFIG ---
331
-
332
199
  nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};
333
- nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };
200
+ nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: void 0 };
334
201
  const nitroRollupSourceMap = nitroConfig.rollupConfig.output.sourcemap;
335
-
336
- // We don't override nitro.rollupConfig.output.sourcemap (undefined by default, but overrides all other server-side source map settings)
337
- if (typeof nitroRollupSourceMap !== 'undefined' && ['hidden', 'inline', true, false].includes(nitroRollupSourceMap)) {
338
- const settingKey = 'nitro.rollupConfig.output.sourcemap';
339
-
202
+ if (typeof nitroRollupSourceMap !== "undefined" && ["hidden", "inline", true, false].includes(nitroRollupSourceMap)) {
203
+ const settingKey = "nitro.rollupConfig.output.sourcemap";
340
204
  validateDifferentSourceMapSettings({
341
- nuxtSettingKey: 'sourcemap.server',
205
+ nuxtSettingKey: "sourcemap.server",
342
206
  nuxtSettingValue: nuxtSourceMap,
343
207
  otherSettingKey: settingKey,
344
- otherSettingValue: nitroRollupSourceMap,
208
+ otherSettingValue: nitroRollupSourceMap
345
209
  });
346
210
  }
347
-
348
211
  nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;
349
212
  if (isDebug) {
350
- // eslint-disable-next-line no-console
351
213
  console.log(
352
- '[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.',
214
+ "[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."
353
215
  );
354
216
  }
355
217
  }
356
-
357
- /**
358
- * Validates that source map settings are consistent between Nuxt and Vite/Nitro configurations.
359
- * Logs a warning if conflicting settings are detected.
360
- *
361
- * @internal Only exported for testing.
362
- */
363
218
  function validateDifferentSourceMapSettings({
364
219
  nuxtSettingKey,
365
220
  nuxtSettingValue,
366
221
  otherSettingKey,
367
- otherSettingValue,
368
- }
369
-
370
- ) {
222
+ otherSettingValue
223
+ }) {
371
224
  if (nuxtSettingValue !== otherSettingValue) {
372
- // eslint-disable-next-line no-console
373
225
  console.warn(
374
- `[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.`,
226
+ `[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.`
375
227
  );
376
228
  }
377
229
  }
378
-
379
- function logKeepEnabledSourceMapSetting(
380
- sentryNuxtModuleOptions,
381
- settingKey,
382
- settingValue,
383
- ) {
230
+ function logKeepEnabledSourceMapSetting(sentryNuxtModuleOptions, settingKey, settingValue) {
384
231
  if (sentryNuxtModuleOptions.debug) {
385
- // eslint-disable-next-line no-console
386
232
  console.log(
387
- `[Sentry] \`${settingKey}\` is enabled with \`${settingValue}\`. This will correctly un-minify the code snippet on the Sentry Issue Details page.`,
233
+ `[Sentry] \`${settingKey}\` is enabled with \`${settingValue}\`. This will correctly un-minify the code snippet on the Sentry Issue Details page.`
388
234
  );
389
235
  }
390
236
  }
391
-
392
237
  function warnExplicitlyDisabledSourceMap(settingKey, isDebug) {
393
238
  if (isDebug) {
394
- // eslint-disable-next-line no-console
395
239
  console.warn(
396
- `[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\`).`,
240
+ `[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\`).`
397
241
  );
398
242
  } else {
399
- // eslint-disable-next-line no-console
400
243
  console.warn(`[Sentry] Source map generation (\`${settingKey}\`) is disabled in your Vite configuration.`);
401
244
  }
402
245
  }
403
-
404
246
  function logSentryEnablesSourceMap(settingKey, settingValue) {
405
- // eslint-disable-next-line no-console
406
247
  console.log(`[Sentry] Enabled source map generation in the build options with \`${settingKey}: ${settingValue}\`.`);
407
248
  }
408
249