@sentry/nuxt 10.41.0 → 10.43.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.
@@ -0,0 +1,54 @@
1
+ import { sentryVitePlugin } from '@sentry/vite-plugin';
2
+ import { extractNuxtSourceMapSetting, validateDifferentSourceMapSettings, getPluginOptions } from './sourceMaps.js';
3
+
4
+ /**
5
+ * Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.
6
+ */
7
+ function createSentryViteConfigPlugin(options
8
+
9
+ ) {
10
+ const { nuxt, moduleOptions, sourceMapsEnabled, shouldDeleteFilesFallback } = options;
11
+ const isDebug = moduleOptions.debug;
12
+
13
+ return {
14
+ name: 'sentry-nuxt-vite-config',
15
+ config(viteConfig, env) {
16
+ // Only run in production builds
17
+ if (!sourceMapsEnabled || env.mode === 'development' || nuxt.options?._prepare) {
18
+ return;
19
+ }
20
+
21
+ // Detect runtime from Vite config
22
+ // In Nuxt, SSR builds have build.ssr: true, client builds don't
23
+ const runtime = viteConfig.build?.ssr ? 'server' : 'client';
24
+
25
+ const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);
26
+
27
+ // Initialize build config if needed
28
+ viteConfig.build = viteConfig.build || {};
29
+ const viteSourceMap = viteConfig.build.sourcemap;
30
+
31
+ // Vite source map options are the same as the Nuxt source map config options (unless overwritten)
32
+ validateDifferentSourceMapSettings({
33
+ nuxtSettingKey: `sourcemap.${runtime}`,
34
+ nuxtSettingValue: nuxtSourceMapSetting,
35
+ otherSettingKey: 'viteConfig.build.sourcemap',
36
+ otherSettingValue: viteSourceMap,
37
+ });
38
+
39
+ if (isDebug) {
40
+ // eslint-disable-next-line no-console
41
+ console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);
42
+ }
43
+
44
+ // Add Sentry plugin by mutating the config
45
+ // Vite plugin is added on the client and server side (plugin runs for both builds)
46
+ // Nuxt client source map is 'false' by default. Warning about this will be shown already in an earlier step, and it's also documented that `nuxt.sourcemap.client` needs to be enabled.
47
+ viteConfig.plugins = viteConfig.plugins || [];
48
+ viteConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));
49
+ },
50
+ };
51
+ }
52
+
53
+ export { createSentryViteConfigPlugin };
54
+ //# sourceMappingURL=sentryVitePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryVitePlugin.js","sources":["../../../src/vite/sentryVitePlugin.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { ConfigEnv, Plugin, UserConfig } from 'vite';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport { extractNuxtSourceMapSetting, getPluginOptions, validateDifferentSourceMapSettings } from './sourceMaps';\n\n/**\n * Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.\n */\nexport function createSentryViteConfigPlugin(options: {\n nuxt: Nuxt;\n moduleOptions: SentryNuxtModuleOptions;\n sourceMapsEnabled: boolean;\n shouldDeleteFilesFallback: { client: boolean; server: boolean };\n}): Plugin {\n const { nuxt, moduleOptions, sourceMapsEnabled, shouldDeleteFilesFallback } = options;\n const isDebug = moduleOptions.debug;\n\n return {\n name: 'sentry-nuxt-vite-config',\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 // 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 if (isDebug) {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);\n }\n\n // Add Sentry plugin by mutating the config\n // Vite plugin is added on the client and server side (plugin runs for both builds)\n // Nuxt client source map is 'false' by default. Warning about this will be shown already in an earlier step, and it's also documented that `nuxt.sourcemap.client` needs to be enabled.\n viteConfig.plugins = viteConfig.plugins || [];\n viteConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));\n },\n };\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC;;AAK7C,EAAW;AACX,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,yBAAA,EAA0B,GAAI,OAAO;AACvF,EAAE,MAAM,OAAA,GAAU,aAAa,CAAC,KAAK;;AAErC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,yBAAyB;AACnC,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;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;;AAEA,MAAA,IAAA,OAAA,EAAA;AACA;AACA,QAAA,OAAA,CAAA,GAAA,CAAA,CAAA,0CAAA,EAAA,OAAA,CAAA,SAAA,CAAA,CAAA;AACA,MAAA;;AAEA;AACA;AACA;AACA,MAAA,UAAA,CAAA,OAAA,GAAA,UAAA,CAAA,OAAA,IAAA,EAAA;AACA,MAAA,UAAA,CAAA,OAAA,CAAA,IAAA,CAAA,gBAAA,CAAA,gBAAA,CAAA,aAAA,EAAA,yBAAA,CAAA,CAAA,CAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { sentryRollupPlugin } from '@sentry/rollup-plugin';
2
- import { sentryVitePlugin } from '@sentry/vite-plugin';
2
+ import { createSentryViteConfigPlugin } from './sentryVitePlugin.js';
3
3
 
4
4
  /**
5
5
  * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps
@@ -8,7 +8,11 @@ import { sentryVitePlugin } from '@sentry/vite-plugin';
8
8
  /**
9
9
  * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).
10
10
  */
11
- function setupSourceMaps(moduleOptions, nuxt) {
11
+ function setupSourceMaps(
12
+ moduleOptions,
13
+ nuxt,
14
+ addVitePlugin,
15
+ ) {
12
16
  // TODO(v11): remove deprecated options (also from SentryNuxtModuleOptions type)
13
17
 
14
18
  const isDebug = moduleOptions.debug;
@@ -25,7 +29,7 @@ function setupSourceMaps(moduleOptions, nuxt) {
25
29
  (sourceMapsUploadOptions.enabled ?? true);
26
30
 
27
31
  // In case we overwrite the source map settings, we default to deleting the files
28
- let shouldDeleteFilesFallback = { client: true, server: true };
32
+ const shouldDeleteFilesFallback = { client: true, server: true };
29
33
 
30
34
  nuxt.hook('modules:done', () => {
31
35
  if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) {
@@ -34,13 +38,12 @@ function setupSourceMaps(moduleOptions, nuxt) {
34
38
  // - for server to viteConfig.build.sourceMap and nitro.sourceMap
35
39
  // On server, nitro.rollupConfig.output.sourcemap remains unaffected from this change.
36
40
 
37
- // ONLY THIS nuxt.sourcemap.(server/client) setting is the one Sentry will eventually overwrite with 'hidden'
41
+ // ONLY THIS nuxt.sourcemap.(server/client) setting is the one Sentry will overwrite with 'hidden', if needed.
38
42
  const previousSourceMapSettings = changeNuxtSourceMapSettings(nuxt, moduleOptions);
39
43
 
40
- shouldDeleteFilesFallback = {
41
- client: previousSourceMapSettings.client === 'unset',
42
- server: previousSourceMapSettings.server === 'unset',
43
- };
44
+ // Mutate in place so the Vite plugin (which captured this object at registration time) sees the updated values
45
+ shouldDeleteFilesFallback.client = previousSourceMapSettings.client === 'unset';
46
+ shouldDeleteFilesFallback.server = previousSourceMapSettings.server === 'unset';
44
47
 
45
48
  if (isDebug && (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)) {
46
49
  const enabledDeleteFallbacks =
@@ -69,39 +72,16 @@ function setupSourceMaps(moduleOptions, nuxt) {
69
72
  }
70
73
  });
71
74
 
72
- nuxt.hook('vite:extendConfig', async (viteConfig, env) => {
73
- if (sourceMapsEnabled && viteConfig.mode !== 'development' && !nuxt.options?._prepare) {
74
- const runtime = env.isServer ? 'server' : env.isClient ? 'client' : undefined;
75
- const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);
76
-
77
- viteConfig.build = viteConfig.build || {};
78
- const viteSourceMap = viteConfig.build.sourcemap;
79
-
80
- // Vite source map options are the same as the Nuxt source map config options (unless overwritten)
81
- validateDifferentSourceMapSettings({
82
- nuxtSettingKey: `sourcemap.${runtime}`,
83
- nuxtSettingValue: nuxtSourceMapSetting,
84
- otherSettingKey: 'viteConfig.build.sourcemap',
85
- otherSettingValue: viteSourceMap,
86
- });
87
-
88
- if (isDebug) {
89
- if (!runtime) {
90
- // eslint-disable-next-line no-console
91
- console.log("[Sentry] Cannot detect runtime (client/server) inside hook 'vite:extendConfig'.");
92
- } else {
93
- // eslint-disable-next-line no-console
94
- console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);
95
- }
96
- }
97
-
98
- // Add Sentry plugin
99
- // Vite plugin is added on the client and server side (hook runs twice)
100
- // Nuxt client source map is 'false' by default. Warning about this will be shown already in an earlier step, and it's also documented that `nuxt.sourcemap.client` needs to be enabled.
101
- viteConfig.plugins = viteConfig.plugins || [];
102
- viteConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));
103
- }
104
- });
75
+ addVitePlugin(
76
+ createSentryViteConfigPlugin({
77
+ nuxt,
78
+ moduleOptions,
79
+ sourceMapsEnabled,
80
+ shouldDeleteFilesFallback,
81
+ }),
82
+ // Only add source map plugin during build
83
+ { dev: false, build: true },
84
+ );
105
85
 
106
86
  nuxt.hook('nitro:config', (nitroConfig) => {
107
87
  if (sourceMapsEnabled && !nitroConfig.dev && !nuxt.options?._prepare) {
@@ -372,6 +352,12 @@ function validateNitroSourceMapSettings(
372
352
  }
373
353
  }
374
354
 
355
+ /**
356
+ * Validates that source map settings are consistent between Nuxt and Vite/Nitro configurations.
357
+ * Logs a warning if conflicting settings are detected.
358
+ *
359
+ * @internal Only exported for testing.
360
+ */
375
361
  function validateDifferentSourceMapSettings({
376
362
  nuxtSettingKey,
377
363
  nuxtSettingValue,
@@ -418,5 +404,5 @@ function logSentryEnablesSourceMap(settingKey, settingValue) {
418
404
  console.log(`[Sentry] Enabled source map generation in the build options with \`${settingKey}: ${settingValue}\`.`);
419
405
  }
420
406
 
421
- export { changeNuxtSourceMapSettings, extractNuxtSourceMapSetting, getPluginOptions, setupSourceMaps, validateNitroSourceMapSettings };
407
+ export { changeNuxtSourceMapSettings, extractNuxtSourceMapSetting, getPluginOptions, setupSourceMaps, validateDifferentSourceMapSettings, validateNitroSourceMapSettings };
422
408
  //# sourceMappingURL=sourceMaps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { sentryRollupPlugin, type SentryRollupPluginOptions } from '@sentry/rollup-plugin';\nimport { sentryVitePlugin, type SentryVitePluginOptions } from '@sentry/vite-plugin';\nimport type { NitroConfig } from 'nitropack';\nimport type { SentryNuxtModuleOptions } from '../common/types';\n\n/**\n * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps\n */\nexport type UserSourceMapSetting = 'enabled' | 'disabled' | 'unset' | undefined;\n\n/** A valid source map setting */\nexport type SourceMapSetting = boolean | 'hidden' | 'inline';\n\n/**\n * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).\n */\nexport function setupSourceMaps(moduleOptions: SentryNuxtModuleOptions, nuxt: Nuxt): void {\n // TODO(v11): remove deprecated options (also from SentryNuxtModuleOptions type)\n\n const isDebug = moduleOptions.debug;\n\n // eslint-disable-next-line deprecation/deprecation\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n const sourceMapsEnabled =\n moduleOptions.sourcemaps?.disable === true\n ? false\n : moduleOptions.sourcemaps?.disable === false\n ? true\n : // eslint-disable-next-line deprecation/deprecation\n (sourceMapsUploadOptions.enabled ?? true);\n\n // In case we overwrite the source map settings, we default to deleting the files\n let shouldDeleteFilesFallback = { client: true, server: true };\n\n nuxt.hook('modules:done', () => {\n if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) {\n // Changing this setting will propagate:\n // - for client to viteConfig.build.sourceMap\n // - for server to viteConfig.build.sourceMap and nitro.sourceMap\n // On server, nitro.rollupConfig.output.sourcemap remains unaffected from this change.\n\n // ONLY THIS nuxt.sourcemap.(server/client) setting is the one Sentry will eventually overwrite with 'hidden'\n const previousSourceMapSettings = changeNuxtSourceMapSettings(nuxt, moduleOptions);\n\n shouldDeleteFilesFallback = {\n client: previousSourceMapSettings.client === 'unset',\n server: previousSourceMapSettings.server === 'unset',\n };\n\n if (isDebug && (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)) {\n const enabledDeleteFallbacks =\n shouldDeleteFilesFallback.client && shouldDeleteFilesFallback.server\n ? 'client-side and server-side'\n : shouldDeleteFilesFallback.server\n ? 'server-side'\n : 'client-side';\n\n if (\n !moduleOptions.sourcemaps?.filesToDeleteAfterUpload &&\n // eslint-disable-next-line deprecation/deprecation\n !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n ) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We enabled \\`'hidden'\\` source maps for your ${enabledDeleteFallbacks} build. Source map files will be automatically deleted after uploading them to Sentry.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[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.`,\n );\n }\n }\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development' && !nuxt.options?._prepare) {\n const runtime = env.isServer ? 'server' : env.isClient ? 'client' : undefined;\n const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);\n\n viteConfig.build = viteConfig.build || {};\n const viteSourceMap = viteConfig.build.sourcemap;\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 if (isDebug) {\n if (!runtime) {\n // eslint-disable-next-line no-console\n console.log(\"[Sentry] Cannot detect runtime (client/server) inside hook 'vite:extendConfig'.\");\n } else {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);\n }\n }\n\n // Add Sentry plugin\n // Vite plugin is added on the client and server side (hook runs twice)\n // Nuxt client source map is 'false' by default. Warning about this will be shown already in an earlier step, and it's also documented that `nuxt.sourcemap.client` needs to be enabled.\n viteConfig.plugins = viteConfig.plugins || [];\n viteConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));\n }\n });\n\n nuxt.hook('nitro:config', (nitroConfig: NitroConfig) => {\n if (sourceMapsEnabled && !nitroConfig.dev && !nuxt.options?._prepare) {\n if (!nitroConfig.rollupConfig) {\n nitroConfig.rollupConfig = {};\n }\n\n if (nitroConfig.rollupConfig.plugins === null || nitroConfig.rollupConfig.plugins === undefined) {\n nitroConfig.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitroConfig.rollupConfig.plugins)) {\n // `rollupConfig.plugins` can be a single plugin, so we want to put it into an array so that we can push our own plugin\n nitroConfig.rollupConfig.plugins = [nitroConfig.rollupConfig.plugins];\n }\n\n validateNitroSourceMapSettings(nuxt, nitroConfig, moduleOptions);\n\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log('[Sentry] Adding Sentry Rollup plugin to the server runtime.');\n }\n\n // Add Sentry plugin\n // Runs only on server-side (Nitro)\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)),\n );\n }\n });\n}\n\n/**\n * Normalizes the beginning of a path from e.g. ../../../ to ./\n */\nfunction normalizePath(path: string): string {\n return path.replace(/^(\\.\\.\\/)+/, './');\n}\n\n/**\n * Generates source maps upload options for the Sentry Vite and Rollup plugin.\n *\n * Only exported for Testing purposes.\n */\n// todo(v11): This \"eslint-disable\" can be removed again once we remove deprecated options.\n// eslint-disable-next-line complexity\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n shouldDeleteFilesFallback?: { client: boolean; server: boolean },\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n // eslint-disable-next-line deprecation/deprecation\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n const shouldDeleteFilesAfterUpload = shouldDeleteFilesFallback?.client || shouldDeleteFilesFallback?.server;\n const fallbackFilesToDelete = [\n ...(shouldDeleteFilesFallback?.client ? ['.*/**/public/**/*.map'] : []),\n ...(shouldDeleteFilesFallback?.server\n ? ['.*/**/server/**/*.map', '.*/**/output/**/*.map', '.*/**/function/**/*.map']\n : []),\n ];\n\n // Check for filesToDeleteAfterUpload in new location first, then deprecated location\n const sourcemapsOptions = moduleOptions.sourcemaps || {};\n // eslint-disable-next-line deprecation/deprecation\n const deprecatedSourcemapsOptions = sourceMapsUploadOptions.sourcemaps || {};\n\n const filesToDeleteAfterUpload =\n sourcemapsOptions.filesToDeleteAfterUpload ??\n // eslint-disable-next-line deprecation/deprecation\n deprecatedSourcemapsOptions.filesToDeleteAfterUpload;\n\n if (typeof filesToDeleteAfterUpload === 'undefined' && shouldDeleteFilesAfterUpload && moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Setting \\`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete\n // Logging it as strings in the array\n .map(path => `\"${path}\"`)\n .join(', ')}]\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n\n return {\n // eslint-disable-next-line deprecation/deprecation\n org: moduleOptions.org ?? sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n // eslint-disable-next-line deprecation/deprecation\n project: moduleOptions.project ?? sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n // eslint-disable-next-line deprecation/deprecation\n authToken: moduleOptions.authToken ?? sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n // eslint-disable-next-line deprecation/deprecation\n telemetry: moduleOptions.telemetry ?? sourceMapsUploadOptions.telemetry ?? true,\n // eslint-disable-next-line deprecation/deprecation\n url: moduleOptions.sentryUrl ?? sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n headers: moduleOptions.headers,\n debug: moduleOptions.debug ?? false,\n // eslint-disable-next-line deprecation/deprecation\n silent: moduleOptions.silent ?? sourceMapsUploadOptions.silent ?? false,\n // eslint-disable-next-line deprecation/deprecation\n errorHandler: moduleOptions.errorHandler ?? sourceMapsUploadOptions.errorHandler,\n bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations, // todo: test if this can be overridden by the user\n release: {\n // eslint-disable-next-line deprecation/deprecation\n name: moduleOptions.release?.name ?? sourceMapsUploadOptions.release?.name,\n // Support all release options from BuildTimeOptionsBase\n ...moduleOptions.release,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\n disable: moduleOptions.sourcemaps?.disable,\n // The server/client files are in different places depending on the nitro preset (e.g. '.output/server' or '.netlify/functions-internal/server')\n // 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).\n // 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/**/*'],\n // eslint-disable-next-line deprecation/deprecation\n assets: sourcemapsOptions.assets ?? deprecatedSourcemapsOptions.assets ?? undefined,\n // eslint-disable-next-line deprecation/deprecation\n ignore: sourcemapsOptions.ignore ?? deprecatedSourcemapsOptions.ignore ?? undefined,\n filesToDeleteAfterUpload: filesToDeleteAfterUpload\n ? filesToDeleteAfterUpload\n : shouldDeleteFilesFallback?.server || shouldDeleteFilesFallback?.client\n ? fallbackFilesToDelete\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* 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)\n 1. User explicitly disabled source maps\n - keep this setting (emit a warning that errors won't be unminified in Sentry)\n - We will not upload anything\n 2. users enabled source map generation (true, hidden, inline).\n - keep this setting (don't do anything - like deletion - besides uploading)\n 3. users did not set source maps generation\n - we enable 'hidden' source maps generation\n - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n\n Users only have to explicitly enable client source maps. Sentry only overwrites the base Nuxt source map settings as they propagate.\n */\n\n/** only exported for tests */\nexport function extractNuxtSourceMapSetting(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting; client?: SourceMapSetting } } },\n runtime: 'client' | 'server' | undefined,\n): SourceMapSetting | undefined {\n if (!runtime) {\n return undefined;\n } else {\n return typeof nuxt.options?.sourcemap === 'boolean' || typeof nuxt.options?.sourcemap === 'string'\n ? nuxt.options.sourcemap\n : nuxt.options?.sourcemap?.[runtime];\n }\n}\n\n/** only exported for testing */\nexport function changeNuxtSourceMapSettings(\n nuxt: Nuxt,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): { client: UserSourceMapSetting; server: UserSourceMapSetting } {\n nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: undefined, client: undefined };\n\n let previousUserSourceMapSetting: { client: UserSourceMapSetting; server: UserSourceMapSetting } = {\n client: undefined,\n server: undefined,\n };\n\n const nuxtSourceMap = nuxt.options.sourcemap;\n const isDebug = sentryModuleOptions.debug;\n\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap', isDebug);\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap', (nuxtSourceMap as true).toString());\n previousUserSourceMapSetting = { client: 'enabled', server: 'enabled' };\n break;\n case undefined:\n nuxt.options.sourcemap = { server: 'hidden', client: 'hidden' };\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client', isDebug);\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server', isDebug);\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** Logs warnings about potentially conflicting source map settings.\n * Configures `sourcemapExcludeSources` in Nitro to make source maps usable in Sentry.\n *\n * only exported for testing\n */\nexport function validateNitroSourceMapSettings(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting } } },\n nitroConfig: NitroConfig,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): void {\n const isDebug = sentryModuleOptions.debug;\n const nuxtSourceMap = extractNuxtSourceMapSetting(nuxt, 'server');\n\n // NITRO CONFIG ---\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: 'nitro.sourceMap',\n otherSettingValue: nitroConfig.sourceMap,\n });\n\n // ROLLUP CONFIG ---\n\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n const nitroRollupSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n // We don't override nitro.rollupConfig.output.sourcemap (undefined by default, but overrides all other server-side source map settings)\n if (typeof nitroRollupSourceMap !== 'undefined' && ['hidden', 'inline', true, false].includes(nitroRollupSourceMap)) {\n const settingKey = 'nitro.rollupConfig.output.sourcemap';\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: settingKey,\n otherSettingValue: nitroRollupSourceMap,\n });\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log(\n '[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.',\n );\n }\n}\n\nfunction validateDifferentSourceMapSettings({\n nuxtSettingKey,\n nuxtSettingValue,\n otherSettingKey,\n otherSettingValue,\n}: {\n nuxtSettingKey: string;\n nuxtSettingValue?: SourceMapSetting;\n otherSettingKey: string;\n otherSettingValue?: SourceMapSetting;\n}): void {\n if (nuxtSettingValue !== otherSettingValue) {\n // eslint-disable-next-line no-console\n console.warn(\n `[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.`,\n );\n }\n}\n\nfunction logKeepEnabledSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] \\`${settingKey}\\` is enabled with \\`${settingValue}\\`. This will correctly un-minify the code snippet on the Sentry Issue Details page.`,\n );\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string, isDebug: boolean | undefined): void {\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[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\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(`[Sentry] Source map generation (\\`${settingKey}\\`) is disabled in your Vite configuration.`);\n }\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;;AAMA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAA2B,IAAI,EAAc;AAC1F;;AAEA,EAAE,MAAM,OAAA,GAAU,aAAa,CAAC,KAAK;;AAErC;AACA,EAAE,MAAM,0BAA0B,aAAa,CAAC,uBAAA,IAA2B,EAAE;;AAE7E,EAAE,MAAM,iBAAA;AACR,IAAI,aAAa,CAAC,UAAU,EAAE,YAAY;AAC1C,QAAQ;AACR,QAAQ,aAAa,CAAC,UAAU,EAAE,YAAY;AAC9C,UAAU;AACV;AACA,WAAW,uBAAuB,CAAC,OAAA,IAAW,IAAI,CAAC;;AAEnD;AACA,EAAE,IAAI,yBAAA,GAA4B,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAA,EAAM;;AAEhE,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM;AAClC,IAAI,IAAI,iBAAA,IAAq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,UAAA,EAAA,YAAA,EAAA;AACA;AACA,EAAA,OAAA,CAAA,GAAA,CAAA,CAAA,mEAAA,EAAA,UAAA,CAAA,EAAA,EAAA,YAAA,CAAA,GAAA,CAAA,CAAA;AACA;;;;"}
1
+ {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { sentryRollupPlugin, type SentryRollupPluginOptions } from '@sentry/rollup-plugin';\nimport type { SentryVitePluginOptions } from '@sentry/vite-plugin';\nimport type { NitroConfig } from 'nitropack';\nimport type { Plugin } from 'vite';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport { createSentryViteConfigPlugin } from './sentryVitePlugin';\n\n/**\n * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps\n */\nexport type UserSourceMapSetting = 'enabled' | 'disabled' | 'unset' | undefined;\n\n/** A valid source map setting */\nexport type SourceMapSetting = boolean | 'hidden' | 'inline';\n\n/**\n * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).\n */\nexport function setupSourceMaps(\n moduleOptions: SentryNuxtModuleOptions,\n nuxt: Nuxt,\n addVitePlugin: (plugin: Plugin | (() => Plugin), options?: { dev?: boolean; build?: boolean }) => void,\n): void {\n // TODO(v11): remove deprecated options (also from SentryNuxtModuleOptions type)\n\n const isDebug = moduleOptions.debug;\n\n // eslint-disable-next-line deprecation/deprecation\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n const sourceMapsEnabled =\n moduleOptions.sourcemaps?.disable === true\n ? false\n : moduleOptions.sourcemaps?.disable === false\n ? true\n : // eslint-disable-next-line deprecation/deprecation\n (sourceMapsUploadOptions.enabled ?? true);\n\n // In case we overwrite the source map settings, we default to deleting the files\n const shouldDeleteFilesFallback = { client: true, server: true };\n\n nuxt.hook('modules:done', () => {\n if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) {\n // Changing this setting will propagate:\n // - for client to viteConfig.build.sourceMap\n // - for server to viteConfig.build.sourceMap and nitro.sourceMap\n // On server, nitro.rollupConfig.output.sourcemap remains unaffected from this change.\n\n // ONLY THIS nuxt.sourcemap.(server/client) setting is the one Sentry will overwrite with 'hidden', if needed.\n const previousSourceMapSettings = changeNuxtSourceMapSettings(nuxt, moduleOptions);\n\n // Mutate in place so the Vite plugin (which captured this object at registration time) sees the updated values\n shouldDeleteFilesFallback.client = previousSourceMapSettings.client === 'unset';\n shouldDeleteFilesFallback.server = previousSourceMapSettings.server === 'unset';\n\n if (isDebug && (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)) {\n const enabledDeleteFallbacks =\n shouldDeleteFilesFallback.client && shouldDeleteFilesFallback.server\n ? 'client-side and server-side'\n : shouldDeleteFilesFallback.server\n ? 'server-side'\n : 'client-side';\n\n if (\n !moduleOptions.sourcemaps?.filesToDeleteAfterUpload &&\n // eslint-disable-next-line deprecation/deprecation\n !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n ) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We enabled \\`'hidden'\\` source maps for your ${enabledDeleteFallbacks} build. Source map files will be automatically deleted after uploading them to Sentry.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[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.`,\n );\n }\n }\n }\n });\n\n addVitePlugin(\n createSentryViteConfigPlugin({\n nuxt,\n moduleOptions,\n sourceMapsEnabled,\n shouldDeleteFilesFallback,\n }),\n // Only add source map plugin during build\n { dev: false, build: true },\n );\n\n nuxt.hook('nitro:config', (nitroConfig: NitroConfig) => {\n if (sourceMapsEnabled && !nitroConfig.dev && !nuxt.options?._prepare) {\n if (!nitroConfig.rollupConfig) {\n nitroConfig.rollupConfig = {};\n }\n\n if (nitroConfig.rollupConfig.plugins === null || nitroConfig.rollupConfig.plugins === undefined) {\n nitroConfig.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitroConfig.rollupConfig.plugins)) {\n // `rollupConfig.plugins` can be a single plugin, so we want to put it into an array so that we can push our own plugin\n nitroConfig.rollupConfig.plugins = [nitroConfig.rollupConfig.plugins];\n }\n\n validateNitroSourceMapSettings(nuxt, nitroConfig, moduleOptions);\n\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log('[Sentry] Adding Sentry Rollup plugin to the server runtime.');\n }\n\n // Add Sentry plugin\n // Runs only on server-side (Nitro)\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)),\n );\n }\n });\n}\n\n/**\n * Normalizes the beginning of a path from e.g. ../../../ to ./\n */\nfunction normalizePath(path: string): string {\n return path.replace(/^(\\.\\.\\/)+/, './');\n}\n\n/**\n * Generates source maps upload options for the Sentry Vite and Rollup plugin.\n *\n * Only exported for Testing purposes.\n */\n// todo(v11): This \"eslint-disable\" can be removed again once we remove deprecated options.\n// eslint-disable-next-line complexity\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n shouldDeleteFilesFallback?: { client: boolean; server: boolean },\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n // eslint-disable-next-line deprecation/deprecation\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n const shouldDeleteFilesAfterUpload = shouldDeleteFilesFallback?.client || shouldDeleteFilesFallback?.server;\n const fallbackFilesToDelete = [\n ...(shouldDeleteFilesFallback?.client ? ['.*/**/public/**/*.map'] : []),\n ...(shouldDeleteFilesFallback?.server\n ? ['.*/**/server/**/*.map', '.*/**/output/**/*.map', '.*/**/function/**/*.map']\n : []),\n ];\n\n // Check for filesToDeleteAfterUpload in new location first, then deprecated location\n const sourcemapsOptions = moduleOptions.sourcemaps || {};\n // eslint-disable-next-line deprecation/deprecation\n const deprecatedSourcemapsOptions = sourceMapsUploadOptions.sourcemaps || {};\n\n const filesToDeleteAfterUpload =\n sourcemapsOptions.filesToDeleteAfterUpload ??\n // eslint-disable-next-line deprecation/deprecation\n deprecatedSourcemapsOptions.filesToDeleteAfterUpload;\n\n if (typeof filesToDeleteAfterUpload === 'undefined' && shouldDeleteFilesAfterUpload && moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Setting \\`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete\n // Logging it as strings in the array\n .map(path => `\"${path}\"`)\n .join(', ')}]\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n\n return {\n // eslint-disable-next-line deprecation/deprecation\n org: moduleOptions.org ?? sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n // eslint-disable-next-line deprecation/deprecation\n project: moduleOptions.project ?? sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n // eslint-disable-next-line deprecation/deprecation\n authToken: moduleOptions.authToken ?? sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n // eslint-disable-next-line deprecation/deprecation\n telemetry: moduleOptions.telemetry ?? sourceMapsUploadOptions.telemetry ?? true,\n // eslint-disable-next-line deprecation/deprecation\n url: moduleOptions.sentryUrl ?? sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n headers: moduleOptions.headers,\n debug: moduleOptions.debug ?? false,\n // eslint-disable-next-line deprecation/deprecation\n silent: moduleOptions.silent ?? sourceMapsUploadOptions.silent ?? false,\n // eslint-disable-next-line deprecation/deprecation\n errorHandler: moduleOptions.errorHandler ?? sourceMapsUploadOptions.errorHandler,\n bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations, // todo: test if this can be overridden by the user\n release: {\n // eslint-disable-next-line deprecation/deprecation\n name: moduleOptions.release?.name ?? sourceMapsUploadOptions.release?.name,\n // Support all release options from BuildTimeOptionsBase\n ...moduleOptions.release,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\n disable: moduleOptions.sourcemaps?.disable,\n // The server/client files are in different places depending on the nitro preset (e.g. '.output/server' or '.netlify/functions-internal/server')\n // 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).\n // 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/**/*'],\n // eslint-disable-next-line deprecation/deprecation\n assets: sourcemapsOptions.assets ?? deprecatedSourcemapsOptions.assets ?? undefined,\n // eslint-disable-next-line deprecation/deprecation\n ignore: sourcemapsOptions.ignore ?? deprecatedSourcemapsOptions.ignore ?? undefined,\n filesToDeleteAfterUpload: filesToDeleteAfterUpload\n ? filesToDeleteAfterUpload\n : shouldDeleteFilesFallback?.server || shouldDeleteFilesFallback?.client\n ? fallbackFilesToDelete\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* 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)\n 1. User explicitly disabled source maps\n - keep this setting (emit a warning that errors won't be unminified in Sentry)\n - We will not upload anything\n 2. users enabled source map generation (true, hidden, inline).\n - keep this setting (don't do anything - like deletion - besides uploading)\n 3. users did not set source maps generation\n - we enable 'hidden' source maps generation\n - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n\n Users only have to explicitly enable client source maps. Sentry only overwrites the base Nuxt source map settings as they propagate.\n */\n\n/** only exported for tests */\nexport function extractNuxtSourceMapSetting(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting; client?: SourceMapSetting } } },\n runtime: 'client' | 'server' | undefined,\n): SourceMapSetting | undefined {\n if (!runtime) {\n return undefined;\n } else {\n return typeof nuxt.options?.sourcemap === 'boolean' || typeof nuxt.options?.sourcemap === 'string'\n ? nuxt.options.sourcemap\n : nuxt.options?.sourcemap?.[runtime];\n }\n}\n\n/** only exported for testing */\nexport function changeNuxtSourceMapSettings(\n nuxt: Nuxt,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): { client: UserSourceMapSetting; server: UserSourceMapSetting } {\n nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: undefined, client: undefined };\n\n let previousUserSourceMapSetting: { client: UserSourceMapSetting; server: UserSourceMapSetting } = {\n client: undefined,\n server: undefined,\n };\n\n const nuxtSourceMap = nuxt.options.sourcemap;\n const isDebug = sentryModuleOptions.debug;\n\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap', isDebug);\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap', (nuxtSourceMap as true).toString());\n previousUserSourceMapSetting = { client: 'enabled', server: 'enabled' };\n break;\n case undefined:\n nuxt.options.sourcemap = { server: 'hidden', client: 'hidden' };\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client', isDebug);\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server', isDebug);\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** Logs warnings about potentially conflicting source map settings.\n * Configures `sourcemapExcludeSources` in Nitro to make source maps usable in Sentry.\n *\n * only exported for testing\n */\nexport function validateNitroSourceMapSettings(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting } } },\n nitroConfig: NitroConfig,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): void {\n const isDebug = sentryModuleOptions.debug;\n const nuxtSourceMap = extractNuxtSourceMapSetting(nuxt, 'server');\n\n // NITRO CONFIG ---\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: 'nitro.sourceMap',\n otherSettingValue: nitroConfig.sourceMap,\n });\n\n // ROLLUP CONFIG ---\n\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n const nitroRollupSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n // We don't override nitro.rollupConfig.output.sourcemap (undefined by default, but overrides all other server-side source map settings)\n if (typeof nitroRollupSourceMap !== 'undefined' && ['hidden', 'inline', true, false].includes(nitroRollupSourceMap)) {\n const settingKey = 'nitro.rollupConfig.output.sourcemap';\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: settingKey,\n otherSettingValue: nitroRollupSourceMap,\n });\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log(\n '[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.',\n );\n }\n}\n\n/**\n * Validates that source map settings are consistent between Nuxt and Vite/Nitro configurations.\n * Logs a warning if conflicting settings are detected.\n *\n * @internal Only exported for testing.\n */\nexport function validateDifferentSourceMapSettings({\n nuxtSettingKey,\n nuxtSettingValue,\n otherSettingKey,\n otherSettingValue,\n}: {\n nuxtSettingKey: string;\n nuxtSettingValue?: SourceMapSetting;\n otherSettingKey: string;\n otherSettingValue?: SourceMapSetting;\n}): void {\n if (nuxtSettingValue !== otherSettingValue) {\n // eslint-disable-next-line no-console\n console.warn(\n `[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.`,\n );\n }\n}\n\nfunction logKeepEnabledSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] \\`${settingKey}\\` is enabled with \\`${settingValue}\\`. This will correctly un-minify the code snippet on the Sentry Issue Details page.`,\n );\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string, isDebug: boolean | undefined): void {\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[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\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(`[Sentry] Source map generation (\\`${settingKey}\\`) is disabled in your Vite configuration.`);\n }\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n}\n"],"names":[],"mappings":";;;AAQA;AACA;AACA;;AAMA;AACA;AACA;AACO,SAAS,eAAe;AAC/B,EAAE,aAAa;AACf,EAAE,IAAI;AACN,EAAE,aAAa;AACf,EAAQ;AACR;;AAEA,EAAE,MAAM,OAAA,GAAU,aAAa,CAAC,KAAK;;AAErC;AACA,EAAE,MAAM,0BAA0B,aAAa,CAAC,uBAAA,IAA2B,EAAE;;AAE7E,EAAE,MAAM,iBAAA;AACR,IAAI,aAAa,CAAC,UAAU,EAAE,YAAY;AAC1C,QAAQ;AACR,QAAQ,aAAa,CAAC,UAAU,EAAE,YAAY;AAC9C,UAAU;AACV;AACA,WAAW,uBAAuB,CAAC,OAAA,IAAW,IAAI,CAAC;;AAEnD;AACA,EAAE,MAAM,yBAAA,GAA4B,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAA,EAAM;;AAElE,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM;AAClC,IAAI,IAAI,iBAAA,IAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAA,IAAO,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE;AAC3E;AACA;AACA;AACA;;AAEA;AACA,MAAM,MAAM,4BAA4B,2BAA2B,CAAC,IAAI,EAAE,aAAa,CAAC;;AAExF;AACA,MAAM,yBAAyB,CAAC,MAAA,GAAS,yBAAyB,CAAC,MAAA,KAAW,OAAO;AACrF,MAAM,yBAAyB,CAAC,MAAA,GAAS,y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;AAChB,MAAM,CAAC,mFAAmF,EAAE,UAAU,CAAC,2QAA2Q,EAAE,UAAU,CAAC,wCAAwC,CAAC;AACxa,KAAK;AACL,EAAE,OAAO;AACT;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,kCAAkC,EAAE,UAAU,CAAC,2CAA2C,CAAC,CAAC;AAC9G,EAAE;AACF;;AAEA,SAAS,yBAAyB,CAAC,UAAU,EAAU,YAAY,EAAgB;AACnF;AACA,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,mEAAmE,EAAE,UAAU,CAAC,EAAE,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;AACrH;;;;"}
@@ -66,7 +66,7 @@ const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';
66
66
  * Only exported for testing.
67
67
  */
68
68
  function removeSentryQueryFromPath(url) {
69
- // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
69
+ // oxlint-disable-next-line sdk/no-regexp-constructor
70
70
  const regex = new RegExp(`\\${SENTRY_WRAPPED_ENTRY}.*?\\${QUERY_END_INDICATOR}`);
71
71
  return url.replace(regex, '');
72
72
  }
@@ -79,11 +79,11 @@ function removeSentryQueryFromPath(url) {
79
79
  */
80
80
  function extractFunctionReexportQueryParameters(query) {
81
81
  // Regex matches the comma-separated params between the functions query
82
- // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
82
+ // oxlint-disable-next-line sdk/no-regexp-constructor
83
83
  const wrapRegex = new RegExp(
84
84
  `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`,
85
85
  );
86
- // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
86
+ // oxlint-disable-next-line sdk/no-regexp-constructor
87
87
  const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`);
88
88
 
89
89
  const wrapMatch = query.match(wrapRegex);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const cwd = process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch?.[1]\n ?.split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n const reexport =\n reexportMatch?.[1]\n ?.split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n \"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt): void {\n if (!nuxt.options.dev) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAAuB,IAAI,EAA6B;AACnG,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACzE,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,IAAA,KAAS,QAAQ,EAAE;AACzB,IAAI,KAAK,MAAM,GAAA,IAAO,sBAAsB,EAAE;AAC9C,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA,CAAA;AACA,MAAA,aAAA,CAAA,IAAA,CAAA,IAAA,CAAA,IAAA,CAAA,QAAA,EAAA,CAAA,WAAA,EAAA,IAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA;AACA,EAAA,CAAA,MAAA;AACA,IAAA,KAAA,MAAA,GAAA,IAAA,sBAAA,EAAA;AACA,MAAA,aAAA,CAAA,IAAA,CAAA,CAAA,OAAA,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AA,CAAA,KAAA,CAAA,0BAAA,CAAA,GAAA,6CAAA;AACA,EAAA;AACA;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const cwd = process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch?.[1]\n ?.split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n const reexport =\n reexportMatch?.[1]\n ?.split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n \"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt): void {\n if (!nuxt.options.dev) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAAuB,IAAI,EAA6B;AACnG,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACzE,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,IAAA,KAAS,QAAQ,EAAE;AACzB,IAAI,KAAK,MAAM,GAAA,IAAO,sBAAsB,EAAE;AAC9C,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA,CAAA;AACA,MAAA,aAAA,CAAA,IAAA,CAAA,IAAA,CAAA,IAAA,CAAA,QAAA,EAAA,CAAA,WAAA,EAAA,IAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA;AACA,EAAA,CAAA,MAAA;AACA,IAAA,KAAA,MAAA,GAAA,IAAA,sBAAA,EAAA;AACA,MAAA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CAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,GAAA,6CAAA;AACA,EAAA;AACA;;;;"}
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "10.41.0",
7
+ "version": "10.43.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -1,4 +1,4 @@
1
- import { createResolver, useNuxt, addServerPlugin, addServerImports, defineNuxtModule, addPluginTemplate, addPlugin, addTemplate } from '@nuxt/kit';
1
+ import { createResolver, useNuxt, addServerPlugin, addServerImports, defineNuxtModule, addPluginTemplate, addPlugin, addTemplate, addVitePlugin } from '@nuxt/kit';
2
2
  import { consoleSandbox, debug } from '@sentry/core';
3
3
  import * as path from 'path';
4
4
  import { existsSync } from 'node:fs';
@@ -340,21 +340,47 @@ ${originalCode.replace(/defineEventHandler\(/g, "defineInstrumentedEventHandler(
340
340
  `;
341
341
  }
342
342
 
343
- function setupSourceMaps(moduleOptions, nuxt) {
343
+ function createSentryViteConfigPlugin(options) {
344
+ const { nuxt, moduleOptions, sourceMapsEnabled, shouldDeleteFilesFallback } = options;
345
+ const isDebug = moduleOptions.debug;
346
+ return {
347
+ name: "sentry-nuxt-vite-config",
348
+ config(viteConfig, env) {
349
+ if (!sourceMapsEnabled || env.mode === "development" || nuxt.options?._prepare) {
350
+ return;
351
+ }
352
+ const runtime = viteConfig.build?.ssr ? "server" : "client";
353
+ const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);
354
+ viteConfig.build = viteConfig.build || {};
355
+ const viteSourceMap = viteConfig.build.sourcemap;
356
+ validateDifferentSourceMapSettings({
357
+ nuxtSettingKey: `sourcemap.${runtime}`,
358
+ nuxtSettingValue: nuxtSourceMapSetting,
359
+ otherSettingKey: "viteConfig.build.sourcemap",
360
+ otherSettingValue: viteSourceMap
361
+ });
362
+ if (isDebug) {
363
+ console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);
364
+ }
365
+ viteConfig.plugins = viteConfig.plugins || [];
366
+ viteConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));
367
+ }
368
+ };
369
+ }
370
+
371
+ function setupSourceMaps(moduleOptions, nuxt, addVitePlugin) {
344
372
  const isDebug = moduleOptions.debug;
345
373
  const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
346
374
  const sourceMapsEnabled = moduleOptions.sourcemaps?.disable === true ? false : moduleOptions.sourcemaps?.disable === false ? true : (
347
375
  // eslint-disable-next-line deprecation/deprecation
348
376
  sourceMapsUploadOptions.enabled ?? true
349
377
  );
350
- let shouldDeleteFilesFallback = { client: true, server: true };
378
+ const shouldDeleteFilesFallback = { client: true, server: true };
351
379
  nuxt.hook("modules:done", () => {
352
380
  if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) {
353
381
  const previousSourceMapSettings = changeNuxtSourceMapSettings(nuxt, moduleOptions);
354
- shouldDeleteFilesFallback = {
355
- client: previousSourceMapSettings.client === "unset",
356
- server: previousSourceMapSettings.server === "unset"
357
- };
382
+ shouldDeleteFilesFallback.client = previousSourceMapSettings.client === "unset";
383
+ shouldDeleteFilesFallback.server = previousSourceMapSettings.server === "unset";
358
384
  if (isDebug && (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)) {
359
385
  const enabledDeleteFallbacks = shouldDeleteFilesFallback.client && shouldDeleteFilesFallback.server ? "client-side and server-side" : shouldDeleteFilesFallback.server ? "server-side" : "client-side";
360
386
  if (!moduleOptions.sourcemaps?.filesToDeleteAfterUpload && // eslint-disable-next-line deprecation/deprecation
@@ -370,29 +396,16 @@ function setupSourceMaps(moduleOptions, nuxt) {
370
396
  }
371
397
  }
372
398
  });
373
- nuxt.hook("vite:extendConfig", async (viteConfig, env) => {
374
- if (sourceMapsEnabled && viteConfig.mode !== "development" && !nuxt.options?._prepare) {
375
- const runtime = env.isServer ? "server" : env.isClient ? "client" : void 0;
376
- const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);
377
- viteConfig.build = viteConfig.build || {};
378
- const viteSourceMap = viteConfig.build.sourcemap;
379
- validateDifferentSourceMapSettings({
380
- nuxtSettingKey: `sourcemap.${runtime}`,
381
- nuxtSettingValue: nuxtSourceMapSetting,
382
- otherSettingKey: "viteConfig.build.sourcemap",
383
- otherSettingValue: viteSourceMap
384
- });
385
- if (isDebug) {
386
- if (!runtime) {
387
- console.log("[Sentry] Cannot detect runtime (client/server) inside hook 'vite:extendConfig'.");
388
- } else {
389
- console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);
390
- }
391
- }
392
- viteConfig.plugins = viteConfig.plugins || [];
393
- viteConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));
394
- }
395
- });
399
+ addVitePlugin(
400
+ createSentryViteConfigPlugin({
401
+ nuxt,
402
+ moduleOptions,
403
+ sourceMapsEnabled,
404
+ shouldDeleteFilesFallback
405
+ }),
406
+ // Only add source map plugin during build
407
+ { dev: false, build: true }
408
+ );
396
409
  nuxt.hook("nitro:config", (nitroConfig) => {
397
410
  if (sourceMapsEnabled && !nitroConfig.dev && !nuxt.options?._prepare) {
398
411
  if (!nitroConfig.rollupConfig) {
@@ -667,7 +680,7 @@ const module = defineNuxtModule({
667
680
  });
668
681
  }
669
682
  if (clientConfigFile || serverConfigFile) {
670
- setupSourceMaps(moduleOptions, nuxt);
683
+ setupSourceMaps(moduleOptions, nuxt, addVitePlugin);
671
684
  }
672
685
  addOTelCommonJSImportAlias(nuxt);
673
686
  const pagesDataTemplate = addTemplate({
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAQ9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,wBA0MG"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAQ9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,wBA0MG"}
@@ -0,0 +1,16 @@
1
+ import type { Nuxt } from '@nuxt/schema';
2
+ import type { Plugin } from 'vite';
3
+ import type { SentryNuxtModuleOptions } from '../common/types';
4
+ /**
5
+ * Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.
6
+ */
7
+ export declare function createSentryViteConfigPlugin(options: {
8
+ nuxt: Nuxt;
9
+ moduleOptions: SentryNuxtModuleOptions;
10
+ sourceMapsEnabled: boolean;
11
+ shouldDeleteFilesFallback: {
12
+ client: boolean;
13
+ server: boolean;
14
+ };
15
+ }): Plugin;
16
+ //# sourceMappingURL=sentryVitePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryVitePlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/sentryVitePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAa,MAAM,EAAc,MAAM,MAAM,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG/D;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACpD,IAAI,EAAE,IAAI,CAAC;IACX,aAAa,EAAE,uBAAuB,CAAC;IACvC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,yBAAyB,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;CACjE,GAAG,MAAM,CA0CT"}
@@ -1,7 +1,8 @@
1
1
  import type { Nuxt } from '@nuxt/schema';
2
2
  import { type SentryRollupPluginOptions } from '@sentry/rollup-plugin';
3
- import { type SentryVitePluginOptions } from '@sentry/vite-plugin';
3
+ import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
4
4
  import type { NitroConfig } from 'nitropack';
5
+ import type { Plugin } from 'vite';
5
6
  import type { SentryNuxtModuleOptions } from '../common/types';
6
7
  /**
7
8
  * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps
@@ -12,7 +13,10 @@ export type SourceMapSetting = boolean | 'hidden' | 'inline';
12
13
  /**
13
14
  * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).
14
15
  */
15
- export declare function setupSourceMaps(moduleOptions: SentryNuxtModuleOptions, nuxt: Nuxt): void;
16
+ export declare function setupSourceMaps(moduleOptions: SentryNuxtModuleOptions, nuxt: Nuxt, addVitePlugin: (plugin: Plugin | (() => Plugin), options?: {
17
+ dev?: boolean;
18
+ build?: boolean;
19
+ }) => void): void;
16
20
  /**
17
21
  * Generates source maps upload options for the Sentry Vite and Rollup plugin.
18
22
  *
@@ -48,4 +52,16 @@ export declare function validateNitroSourceMapSettings(nuxt: {
48
52
  };
49
53
  };
50
54
  }, nitroConfig: NitroConfig, sentryModuleOptions: SentryNuxtModuleOptions): void;
55
+ /**
56
+ * Validates that source map settings are consistent between Nuxt and Vite/Nitro configurations.
57
+ * Logs a warning if conflicting settings are detected.
58
+ *
59
+ * @internal Only exported for testing.
60
+ */
61
+ export declare function validateDifferentSourceMapSettings({ nuxtSettingKey, nuxtSettingValue, otherSettingKey, otherSettingValue, }: {
62
+ nuxtSettingKey: string;
63
+ nuxtSettingValue?: SourceMapSetting;
64
+ otherSettingKey: string;
65
+ otherSettingValue?: SourceMapSetting;
66
+ }): void;
51
67
  //# sourceMappingURL=sourceMaps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.d.ts","sourceRoot":"","sources":["../../../src/vite/sourceMaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IA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