@sentry/nuxt 10.41.0 → 10.42.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.
@@ -79,7 +79,7 @@ const module$1 = kit.defineNuxtModule({
79
79
  }
80
80
 
81
81
  if (clientConfigFile || serverConfigFile) {
82
- sourceMaps.setupSourceMaps(moduleOptions, nuxt);
82
+ sourceMaps.setupSourceMaps(moduleOptions, nuxt, kit.addVitePlugin);
83
83
  }
84
84
 
85
85
  utils.addOTelCommonJSImportAlias(nuxt);
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":["defineNuxtModule","createResolver","findDefaultSdkInitFile","addPluginTemplate","addPlugin","addServerPlugin","setupSourceMaps","addOTelCommonJSImportAlias","addTemplate","addMiddlewareImports","addStorageInstrumentation","addDatabaseInstrumentation","addMiddlewareInstr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KAAA,CAAA,OAAA,CAAA,GAAA,EAAA;AACA;AACA,gBAAA,OAAA,CAAA,GAAA;AACA,kBAAA,CAAA,iHAAA,EAAA,wBAAA,CAAA,mJAAA,CAAA;AACA,iBAAA;AACA,cAAA,CAAA,MAAA;AACA;AACA,gBAAA,OAAA,CAAA,GAAA;AACA,kBAAA,CAAA,sGAAA,EAAA,wBAAA,CAAA,mEAAA,EAAA,wBAAA,CAAA,gBAAA,CAAA;AACA,iBAAA;AACA,cAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,kBAAA,EAAA;AACA,UAAAE,kCAAA,CAAA,aAAA,EAAA,KAAA,CAAA;AACA,QAAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,6BAAA,EAAA;AACA,UAAAC,gDAAA,CAAA,KAAA,EAAA,gBAAA,EAAA,aAAA,CAAA;;AAEA,UAAA,IAAA,aAAA,CAAA,KAAA,EAAA;AACA,YAAAH,mBAAA,CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA;AACA,EAAA,CAAA;AACA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n addVitePlugin,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt, addVitePlugin);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":["defineNuxtModule","createResolver","findDefaultSdkInitFile","addPluginTemplate","addPlugin","addServerPlugin","setupSourceMaps","addVitePlugin","addOTelCommonJSImportAlias","addTemplate","addMiddlewareImports","addStorageInstrumentation","addDatabaseInstrumentation","addMiddlewareInstrumentation","consoleSandbox","addServerConfigToBuild","addSentryTopImport","addDynamicImportEntryFileWrapper"],"mappings":";;;;;;;;;;;AAqBA,iBAAeA,oBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE;AAClC,IAAI,IAAI,kBAAkB,EAAE,OAAA,KAAY,KAAK,EAAE;AAC/C,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,gBAAgB;AAC1B,MAAM,GAAG,kBAAkB;AAC3B,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,sBAAsB;AACvE,MAAM,uCAAuC,EAAE,kBAAkB,CAAC,2CAA2C;AAC7G,QAAQ,SAAS;AACjB,QAAQ,SAAS;AACjB,QAAQ,QAAQ;AAChB,OAAO;AACP,KAAK;;AAEL,IAAI,MAAM,iBAAA,GAAoBC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;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA;AACA,EAAA,CAAA;AACA,CAAA,CAAA;;;;"}
@@ -0,0 +1,56 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const vitePlugin = require('@sentry/vite-plugin');
4
+ const sourceMaps = require('./sourceMaps.js');
5
+
6
+ /**
7
+ * Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.
8
+ */
9
+ function createSentryViteConfigPlugin(options
10
+
11
+ ) {
12
+ const { nuxt, moduleOptions, sourceMapsEnabled, shouldDeleteFilesFallback } = options;
13
+ const isDebug = moduleOptions.debug;
14
+
15
+ return {
16
+ name: 'sentry-nuxt-vite-config',
17
+ config(viteConfig, env) {
18
+ // Only run in production builds
19
+ if (!sourceMapsEnabled || env.mode === 'development' || nuxt.options?._prepare) {
20
+ return;
21
+ }
22
+
23
+ // Detect runtime from Vite config
24
+ // In Nuxt, SSR builds have build.ssr: true, client builds don't
25
+ const runtime = viteConfig.build?.ssr ? 'server' : 'client';
26
+
27
+ const nuxtSourceMapSetting = sourceMaps.extractNuxtSourceMapSetting(nuxt, runtime);
28
+
29
+ // Initialize build config if needed
30
+ viteConfig.build = viteConfig.build || {};
31
+ const viteSourceMap = viteConfig.build.sourcemap;
32
+
33
+ // Vite source map options are the same as the Nuxt source map config options (unless overwritten)
34
+ sourceMaps.validateDifferentSourceMapSettings({
35
+ nuxtSettingKey: `sourcemap.${runtime}`,
36
+ nuxtSettingValue: nuxtSourceMapSetting,
37
+ otherSettingKey: 'viteConfig.build.sourcemap',
38
+ otherSettingValue: viteSourceMap,
39
+ });
40
+
41
+ if (isDebug) {
42
+ // eslint-disable-next-line no-console
43
+ console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);
44
+ }
45
+
46
+ // Add Sentry plugin by mutating the config
47
+ // Vite plugin is added on the client and server side (plugin runs for both builds)
48
+ // 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.
49
+ viteConfig.plugins = viteConfig.plugins || [];
50
+ viteConfig.plugins.push(vitePlugin.sentryVitePlugin(sourceMaps.getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));
51
+ },
52
+ };
53
+ }
54
+
55
+ exports.createSentryViteConfigPlugin = createSentryViteConfigPlugin;
56
+ //# 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":["extractNuxtSourceMapSetting","validateDifferentSourceMapSettings","sentryVitePlugin","getPluginOptions"],"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,uBAAuBA,sCAA2B,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,MAAMC,6CAAkC,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,CAAAC,2BAAA,CAAAC,2BAAA,CAAA,aAAA,EAAA,yBAAA,CAAA,CAAA,CAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA;;;;"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const rollupPlugin = require('@sentry/rollup-plugin');
4
- const vitePlugin = require('@sentry/vite-plugin');
4
+ const sentryVitePlugin = require('./sentryVitePlugin.js');
5
5
 
6
6
  /**
7
7
  * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps
@@ -10,7 +10,11 @@ const vitePlugin = require('@sentry/vite-plugin');
10
10
  /**
11
11
  * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).
12
12
  */
13
- function setupSourceMaps(moduleOptions, nuxt) {
13
+ function setupSourceMaps(
14
+ moduleOptions,
15
+ nuxt,
16
+ addVitePlugin,
17
+ ) {
14
18
  // TODO(v11): remove deprecated options (also from SentryNuxtModuleOptions type)
15
19
 
16
20
  const isDebug = moduleOptions.debug;
@@ -27,7 +31,7 @@ function setupSourceMaps(moduleOptions, nuxt) {
27
31
  (sourceMapsUploadOptions.enabled ?? true);
28
32
 
29
33
  // In case we overwrite the source map settings, we default to deleting the files
30
- let shouldDeleteFilesFallback = { client: true, server: true };
34
+ const shouldDeleteFilesFallback = { client: true, server: true };
31
35
 
32
36
  nuxt.hook('modules:done', () => {
33
37
  if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) {
@@ -36,13 +40,12 @@ function setupSourceMaps(moduleOptions, nuxt) {
36
40
  // - for server to viteConfig.build.sourceMap and nitro.sourceMap
37
41
  // On server, nitro.rollupConfig.output.sourcemap remains unaffected from this change.
38
42
 
39
- // ONLY THIS nuxt.sourcemap.(server/client) setting is the one Sentry will eventually overwrite with 'hidden'
43
+ // ONLY THIS nuxt.sourcemap.(server/client) setting is the one Sentry will overwrite with 'hidden', if needed.
40
44
  const previousSourceMapSettings = changeNuxtSourceMapSettings(nuxt, moduleOptions);
41
45
 
42
- shouldDeleteFilesFallback = {
43
- client: previousSourceMapSettings.client === 'unset',
44
- server: previousSourceMapSettings.server === 'unset',
45
- };
46
+ // Mutate in place so the Vite plugin (which captured this object at registration time) sees the updated values
47
+ shouldDeleteFilesFallback.client = previousSourceMapSettings.client === 'unset';
48
+ shouldDeleteFilesFallback.server = previousSourceMapSettings.server === 'unset';
46
49
 
47
50
  if (isDebug && (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)) {
48
51
  const enabledDeleteFallbacks =
@@ -71,39 +74,16 @@ function setupSourceMaps(moduleOptions, nuxt) {
71
74
  }
72
75
  });
73
76
 
74
- nuxt.hook('vite:extendConfig', async (viteConfig, env) => {
75
- if (sourceMapsEnabled && viteConfig.mode !== 'development' && !nuxt.options?._prepare) {
76
- const runtime = env.isServer ? 'server' : env.isClient ? 'client' : undefined;
77
- const nuxtSourceMapSetting = extractNuxtSourceMapSetting(nuxt, runtime);
78
-
79
- viteConfig.build = viteConfig.build || {};
80
- const viteSourceMap = viteConfig.build.sourcemap;
81
-
82
- // Vite source map options are the same as the Nuxt source map config options (unless overwritten)
83
- validateDifferentSourceMapSettings({
84
- nuxtSettingKey: `sourcemap.${runtime}`,
85
- nuxtSettingValue: nuxtSourceMapSetting,
86
- otherSettingKey: 'viteConfig.build.sourcemap',
87
- otherSettingValue: viteSourceMap,
88
- });
89
-
90
- if (isDebug) {
91
- if (!runtime) {
92
- // eslint-disable-next-line no-console
93
- console.log("[Sentry] Cannot detect runtime (client/server) inside hook 'vite:extendConfig'.");
94
- } else {
95
- // eslint-disable-next-line no-console
96
- console.log(`[Sentry] Adding Sentry Vite plugin to the ${runtime} runtime.`);
97
- }
98
- }
99
-
100
- // Add Sentry plugin
101
- // Vite plugin is added on the client and server side (hook runs twice)
102
- // 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.
103
- viteConfig.plugins = viteConfig.plugins || [];
104
- viteConfig.plugins.push(vitePlugin.sentryVitePlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)));
105
- }
106
- });
77
+ addVitePlugin(
78
+ sentryVitePlugin.createSentryViteConfigPlugin({
79
+ nuxt,
80
+ moduleOptions,
81
+ sourceMapsEnabled,
82
+ shouldDeleteFilesFallback,
83
+ }),
84
+ // Only add source map plugin during build
85
+ { dev: false, build: true },
86
+ );
107
87
 
108
88
  nuxt.hook('nitro:config', (nitroConfig) => {
109
89
  if (sourceMapsEnabled && !nitroConfig.dev && !nuxt.options?._prepare) {
@@ -374,6 +354,12 @@ function validateNitroSourceMapSettings(
374
354
  }
375
355
  }
376
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
+ */
377
363
  function validateDifferentSourceMapSettings({
378
364
  nuxtSettingKey,
379
365
  nuxtSettingValue,
@@ -424,5 +410,6 @@ exports.changeNuxtSourceMapSettings = changeNuxtSourceMapSettings;
424
410
  exports.extractNuxtSourceMapSetting = extractNuxtSourceMapSetting;
425
411
  exports.getPluginOptions = getPluginOptions;
426
412
  exports.setupSourceMaps = setupSourceMaps;
413
+ exports.validateDifferentSourceMapSettings = validateDifferentSourceMapSettings;
427
414
  exports.validateNitroSourceMapSettings = validateNitroSourceMapSettings;
428
415
  //# 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":["sentryVitePlugin","sentryRollupPlugin"],"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,IAA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,EAAA,UAAA,CAAA,wCAAA,CAAA;AACA,KAAA;AACA,EAAA,CAAA,MAAA;AACA;AACA,IAAA,OAAA,CAAA,IAAA,CAAA,CAAA,kCAAA,EAAA,UAAA,CAAA,2CAAA,CAAA,CAAA;AACA,EAAA;AACA;;AAEA,SAAA,yBAAA,CAAA,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":["createSentryViteConfigPlugin","sentryRollupPlugin"],"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,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AC,GAAG;AACf,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,qBAAqB,EAAE,YAAY,CAAC,oFAAoF,CAAC;AACxJ,KAAK;AACL,EAAE;AACF;;AAEA,SAAS,+BAA+B,CAAC,UAAU,EAAU,OAAO,EAA6B;AACjG,EAAE,IAAI,OAAO,EAAE;AACf;AACA,IAAI,OAAO,CAAC,IAAI;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;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, addPluginTemplate, addPlugin, addServerPlugin, addTemplate } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addPluginTemplate, addPlugin, addServerPlugin, addTemplate, addVitePlugin } from '@nuxt/kit';
2
2
  import { consoleSandbox } from '@sentry/core';
3
3
  import * as path from 'path';
4
4
  import { addServerConfigToBuild, addSentryTopImport, addDynamicImportEntryFileWrapper } from './vite/addServerConfig.js';
@@ -78,7 +78,7 @@ const module$1 = defineNuxtModule({
78
78
  }
79
79
 
80
80
  if (clientConfigFile || serverConfigFile) {
81
- setupSourceMaps(moduleOptions, nuxt);
81
+ setupSourceMaps(moduleOptions, nuxt, addVitePlugin);
82
82
  }
83
83
 
84
84
  addOTelCommonJSImportAlias(nuxt);
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,iBAAe,gBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE;AAClC,IAAI,IAAI,kBAAkB,EAAE,OAAA,KAAY,KAAK,EAAE;AAC/C,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,gBAAgB;AAC1B,MAAM,GAAG,kBAAkB;AAC3B,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,sBAAsB;AACvE,MAAM,uCAAuC,EAAE,kBAAkB,CAAC,2CAA2C;AAC7G,QAAQ,SAAS;AACjB,QAAQ,SAAS;AACjB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CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA;AACA,EAAA,CAAA;AACA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n addVitePlugin,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt, addVitePlugin);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAqBA,iBAAe,gBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,kBAAkB,EAAE,IAAI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AAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,kBAAA,EAAA;AACA,UAAA,kBAAA,CAAA,aAAA,EAAA,KAAA,CAAA;AACA,QAAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,6BAAA,EAAA;AACA,UAAA,gCAAA,CAAA,KAAA,EAAA,gBAAA,EAAA,aAAA,CAAA;;AAEA,UAAA,IAAA,aAAA,CAAA,KAAA,EAAA;AACA,YAAA,cAAA,CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA;AACA,EAAA,CAAA;AACA,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.41.0"}
1
+ {"type":"module","version":"10.42.0"}
@@ -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,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A,WAAA,EAAA,UAAA,CAAA,qBAAA,EAAA,YAAA,CAAA,oFAAA,CAAA;AACA,KAAA;AACA,EAAA;AACA;;AAEA,SAAA,+BAAA,CAAA,UAAA,EAAA,OAAA,EAAA;AACA,EAAA,IAAA,OAAA,EAAA;AACA;AACA,IAAA,OAAA,CAAA,IAAA;AACA,MAAA,CAAA,mFAAA,EAAA,UAAA,CAAA,2QAAA,EAAA,UAAA,CAAA,wCAAA,CAAA;AACA,KAAA;AACA,EAAA,CAAA,MAAA;AACA;AACA,IAAA,OAAA,CAAA,IAAA,CAAA,CAAA,kCAAA,EAAA,UAAA,CAAA,2CAAA,CAAA,CAAA;AACA,EAAA;AACA;;AAEA,SAAA,yBAAA,CAAA,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,y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BAAiB,CAAC,+OAA+O,CAAC;AACjc,KAAK;AACL,EAAE;AACF;;AAEA,SAAS,8BAA8B;AACvC,EAAE,uBAAuB;AACzB,EAAE,UAAU;AACZ,EAAE,YAAY;AACd,EAAQ;AACR,EAAE,IAAI,uBAAuB,CAAC,KAAK,EAAE;AACrC;AACA,IAAI,OAAO,CAAC,GAAG;AACf,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,qBAAqB,EAAE,YAAY,CAAC,oFAAoF,CAAC;AACxJ,KAAK;AACL,EAAE;AACF;;AAEA,SAAS,+BAA+B,CAAC,UAAU,EAAU,OAAO,EAA6B;AACjG,EAAE,IAAI,OAAO,EAAE;AACf;AACA,IAAI,OAAO,CAAC,IAAI;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;;;;"}
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "10.41.0",
7
+ "version": "10.42.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,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAsB,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhF,iCAAiC;AACjC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D;;GAEG;AACH,wBAAgB,eAAe,CAA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,mBAAmB,EAAE,uBAAuB,GAC3C;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAyDhE;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE;IAAE,OAAO,EAAE;QAAE,SAAS,CAAC,EAAE,gBAAgB,GAAG;YAAE,MAAM,CAAC,EAAE,gBAAgB,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,EACnF,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAsCN;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,EACjD,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;CACtC,GAAG,IAAI,CAOP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "10.41.0",
3
+ "version": "10.42.0",
4
4
  "description": "Official Sentry SDK for Nuxt",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
@@ -49,14 +49,14 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@nuxt/kit": "^3.13.2",
52
- "@sentry/browser": "10.41.0",
53
- "@sentry/cloudflare": "10.41.0",
54
- "@sentry/core": "10.41.0",
55
- "@sentry/node": "10.41.0",
56
- "@sentry/node-core": "10.41.0",
52
+ "@sentry/browser": "10.42.0",
53
+ "@sentry/cloudflare": "10.42.0",
54
+ "@sentry/core": "10.42.0",
55
+ "@sentry/node": "10.42.0",
56
+ "@sentry/node-core": "10.42.0",
57
57
  "@sentry/rollup-plugin": "^5.1.0",
58
58
  "@sentry/vite-plugin": "^5.1.0",
59
- "@sentry/vue": "10.41.0"
59
+ "@sentry/vue": "10.42.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@nuxt/module-builder": "^0.8.4",