@sentry/nuxt 9.9.0 → 9.10.1

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.
@@ -139,7 +139,6 @@ function changeNuxtSourceMapSettings(
139
139
  nuxt,
140
140
  sentryModuleOptions,
141
141
  ) {
142
- nuxt.options = nuxt.options || {};
143
142
  nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: undefined, client: undefined };
144
143
 
145
144
  let previousUserSourceMapSetting = {
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { NitroConfig } from 'nitropack';\nimport type { OutputOptions } from 'rollup';\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/**\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 const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n const sourceMapsEnabled = sourceMapsUploadOptions.enabled ?? true;\n\n nuxt.hook('modules:done', () => {\n if (sourceMapsEnabled && !nuxt.options.dev) {\n changeNuxtSourceMapSettings(nuxt, moduleOptions);\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, _env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\n const previousUserSourceMapSetting = changeViteSourceMapSettings(viteConfig, moduleOptions);\n\n // Add Sentry plugin\n viteConfig.plugins = viteConfig.plugins || [];\n viteConfig.plugins.push(\n sentryVitePlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\n );\n }\n });\n\n nuxt.hook('nitro:config', (nitroConfig: NitroConfig) => {\n if (sourceMapsEnabled && !nitroConfig.dev) {\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 const previousUserSourceMapSetting = changeRollupSourceMapSettings(nitroConfig, moduleOptions);\n\n // Add Sentry plugin\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\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 */\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n deleteFilesAfterUpload: boolean,\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n if (typeof sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload === 'undefined' && deleteFilesAfterUpload) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Setting `sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [\".*/**/public/**/*.map\"]` to delete generated source maps after they were uploaded to Sentry.',\n );\n });\n }\n\n return {\n org: sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n project: sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n authToken: sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n telemetry: sourceMapsUploadOptions.telemetry ?? true,\n url: sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n debug: moduleOptions.debug ?? false,\n silent: sourceMapsUploadOptions.silent ?? false,\n errorHandler: sourceMapsUploadOptions.errorHandler,\n release: {\n name: sourceMapsUploadOptions.release?.name,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\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 assets: sourceMapsUploadOptions.sourcemaps?.assets ?? undefined,\n ignore: sourceMapsUploadOptions.sourcemaps?.ignore ?? undefined,\n filesToDeleteAfterUpload: sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n ? sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n : deleteFilesAfterUpload\n ? ['.*/**/public/**/*.map']\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* There are 3 ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993)\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 Nuxt has 3 places to set source maps: vite options, rollup options, nuxt itself\n Ideally, all 3 are enabled to get all source maps.\n */\n\n/** only exported for testing */\nexport function changeNuxtSourceMapSettings(\n nuxt: Nuxt,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): { client: UserSourceMapSetting; server: UserSourceMapSetting } {\n nuxt.options = nuxt.options || {};\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\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap');\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepSourceMapSetting(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 logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client');\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server');\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeViteSourceMapSettings(\n viteConfig: { build?: { sourcemap?: boolean | 'inline' | 'hidden' } },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n viteConfig.build = viteConfig.build || {};\n const viteSourceMap = viteConfig.build.sourcemap;\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n if (viteSourceMap === false) {\n warnExplicitlyDisabledSourceMap('vite.build.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'vite.build.sourcemap', viteSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n viteConfig.build.sourcemap = 'hidden';\n logSentryEnablesSourceMap('vite.build.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeRollupSourceMapSettings(\n nitroConfig: {\n rollupConfig?: {\n output?: {\n sourcemap?: OutputOptions['sourcemap'];\n sourcemapExcludeSources?: OutputOptions['sourcemapExcludeSources'];\n };\n };\n },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n const nitroSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n if (nitroSourceMap === false) {\n warnExplicitlyDisabledSourceMap('nitro.rollupConfig.output.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (nitroSourceMap && ['hidden', 'inline', true].includes(nitroSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'nitro.rollupConfig.output.sourcemap', nitroSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n nitroConfig.rollupConfig.output.sourcemap = 'hidden';\n logSentryEnablesSourceMap('nitro.rollupConfig.output.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Disabled source map setting in the Nuxt config: `nitro.rollupConfig.output.sourcemapExcludeSources`. Source maps will include the actual code to be able to un-minify code snippets in Sentry.',\n );\n });\n\n return previousUserSourceMapSetting;\n}\n\nfunction logKeepSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${settingValue}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Parts of source map generation are currently disabled in your Nuxt 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 });\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n });\n}\n"],"names":["sentryVitePlugin","sent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;AACvB;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,mEAAmE,EAAE,UAAU,CAAC,EAAE,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;AACvH,GAAG,CAAC;AACJ;;;;;;;;"}
1
+ {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { NitroConfig } from 'nitropack';\nimport type { OutputOptions } from 'rollup';\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/**\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 const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n const sourceMapsEnabled = sourceMapsUploadOptions.enabled ?? true;\n\n nuxt.hook('modules:done', () => {\n if (sourceMapsEnabled && !nuxt.options.dev) {\n changeNuxtSourceMapSettings(nuxt, moduleOptions);\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, _env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\n const previousUserSourceMapSetting = changeViteSourceMapSettings(viteConfig, moduleOptions);\n\n // Add Sentry plugin\n viteConfig.plugins = viteConfig.plugins || [];\n viteConfig.plugins.push(\n sentryVitePlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\n );\n }\n });\n\n nuxt.hook('nitro:config', (nitroConfig: NitroConfig) => {\n if (sourceMapsEnabled && !nitroConfig.dev) {\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 const previousUserSourceMapSetting = changeRollupSourceMapSettings(nitroConfig, moduleOptions);\n\n // Add Sentry plugin\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\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 */\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n deleteFilesAfterUpload: boolean,\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n if (typeof sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload === 'undefined' && deleteFilesAfterUpload) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Setting `sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [\".*/**/public/**/*.map\"]` to delete generated source maps after they were uploaded to Sentry.',\n );\n });\n }\n\n return {\n org: sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n project: sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n authToken: sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n telemetry: sourceMapsUploadOptions.telemetry ?? true,\n url: sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n debug: moduleOptions.debug ?? false,\n silent: sourceMapsUploadOptions.silent ?? false,\n errorHandler: sourceMapsUploadOptions.errorHandler,\n release: {\n name: sourceMapsUploadOptions.release?.name,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\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 assets: sourceMapsUploadOptions.sourcemaps?.assets ?? undefined,\n ignore: sourceMapsUploadOptions.sourcemaps?.ignore ?? undefined,\n filesToDeleteAfterUpload: sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n ? sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n : deleteFilesAfterUpload\n ? ['.*/**/public/**/*.map']\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* There are 3 ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993)\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 Nuxt has 3 places to set source maps: vite options, rollup options, nuxt itself\n Ideally, all 3 are enabled to get all source maps.\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\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap');\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepSourceMapSetting(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 logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client');\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server');\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeViteSourceMapSettings(\n viteConfig: { build?: { sourcemap?: boolean | 'inline' | 'hidden' } },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n viteConfig.build = viteConfig.build || {};\n const viteSourceMap = viteConfig.build.sourcemap;\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n if (viteSourceMap === false) {\n warnExplicitlyDisabledSourceMap('vite.build.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'vite.build.sourcemap', viteSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n viteConfig.build.sourcemap = 'hidden';\n logSentryEnablesSourceMap('vite.build.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeRollupSourceMapSettings(\n nitroConfig: {\n rollupConfig?: {\n output?: {\n sourcemap?: OutputOptions['sourcemap'];\n sourcemapExcludeSources?: OutputOptions['sourcemapExcludeSources'];\n };\n };\n },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n const nitroSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n if (nitroSourceMap === false) {\n warnExplicitlyDisabledSourceMap('nitro.rollupConfig.output.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (nitroSourceMap && ['hidden', 'inline', true].includes(nitroSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'nitro.rollupConfig.output.sourcemap', nitroSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n nitroConfig.rollupConfig.output.sourcemap = 'hidden';\n logSentryEnablesSourceMap('nitro.rollupConfig.output.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Disabled source map setting in the Nuxt config: `nitro.rollupConfig.output.sourcemapExcludeSources`. Source maps will include the actual code to be able to un-minify code snippets in Sentry.',\n );\n });\n\n return previousUserSourceMapSetting;\n}\n\nfunction logKeepSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${settingValue}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Parts of source map generation are currently disabled in your Nuxt 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 });\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n });\n}\n"],"names":["sentryVitePlugin","sentryRollupPlugin","consoleSandbox"],"mappings":";;;;;;AAQA;AACA;AACA;;AAGA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAA2B,IAAI,EAAc;AAC1F,EAAE,MAAM,0BAA0B,aAAa,CAAC,uBAAwB,IAAG,EAAE;AAC7E,EAAE,M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
137
137
  nuxt,
138
138
  sentryModuleOptions,
139
139
  ) {
140
- nuxt.options = nuxt.options || {};
141
140
  nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: undefined, client: undefined };
142
141
 
143
142
  let previousUserSourceMapSetting = {
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { NitroConfig } from 'nitropack';\nimport type { OutputOptions } from 'rollup';\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/**\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 const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n const sourceMapsEnabled = sourceMapsUploadOptions.enabled ?? true;\n\n nuxt.hook('modules:done', () => {\n if (sourceMapsEnabled && !nuxt.options.dev) {\n changeNuxtSourceMapSettings(nuxt, moduleOptions);\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, _env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\n const previousUserSourceMapSetting = changeViteSourceMapSettings(viteConfig, moduleOptions);\n\n // Add Sentry plugin\n viteConfig.plugins = viteConfig.plugins || [];\n viteConfig.plugins.push(\n sentryVitePlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\n );\n }\n });\n\n nuxt.hook('nitro:config', (nitroConfig: NitroConfig) => {\n if (sourceMapsEnabled && !nitroConfig.dev) {\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 const previousUserSourceMapSetting = changeRollupSourceMapSettings(nitroConfig, moduleOptions);\n\n // Add Sentry plugin\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\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 */\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n deleteFilesAfterUpload: boolean,\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n if (typeof sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload === 'undefined' && deleteFilesAfterUpload) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Setting `sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [\".*/**/public/**/*.map\"]` to delete generated source maps after they were uploaded to Sentry.',\n );\n });\n }\n\n return {\n org: sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n project: sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n authToken: sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n telemetry: sourceMapsUploadOptions.telemetry ?? true,\n url: sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n debug: moduleOptions.debug ?? false,\n silent: sourceMapsUploadOptions.silent ?? false,\n errorHandler: sourceMapsUploadOptions.errorHandler,\n release: {\n name: sourceMapsUploadOptions.release?.name,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\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 assets: sourceMapsUploadOptions.sourcemaps?.assets ?? undefined,\n ignore: sourceMapsUploadOptions.sourcemaps?.ignore ?? undefined,\n filesToDeleteAfterUpload: sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n ? sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n : deleteFilesAfterUpload\n ? ['.*/**/public/**/*.map']\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* There are 3 ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993)\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 Nuxt has 3 places to set source maps: vite options, rollup options, nuxt itself\n Ideally, all 3 are enabled to get all source maps.\n */\n\n/** only exported for testing */\nexport function changeNuxtSourceMapSettings(\n nuxt: Nuxt,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): { client: UserSourceMapSetting; server: UserSourceMapSetting } {\n nuxt.options = nuxt.options || {};\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\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap');\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepSourceMapSetting(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 logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client');\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server');\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeViteSourceMapSettings(\n viteConfig: { build?: { sourcemap?: boolean | 'inline' | 'hidden' } },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n viteConfig.build = viteConfig.build || {};\n const viteSourceMap = viteConfig.build.sourcemap;\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n if (viteSourceMap === false) {\n warnExplicitlyDisabledSourceMap('vite.build.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'vite.build.sourcemap', viteSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n viteConfig.build.sourcemap = 'hidden';\n logSentryEnablesSourceMap('vite.build.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeRollupSourceMapSettings(\n nitroConfig: {\n rollupConfig?: {\n output?: {\n sourcemap?: OutputOptions['sourcemap'];\n sourcemapExcludeSources?: OutputOptions['sourcemapExcludeSources'];\n };\n };\n },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n const nitroSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n if (nitroSourceMap === false) {\n warnExplicitlyDisabledSourceMap('nitro.rollupConfig.output.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (nitroSourceMap && ['hidden', 'inline', true].includes(nitroSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'nitro.rollupConfig.output.sourcemap', nitroSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n nitroConfig.rollupConfig.output.sourcemap = 'hidden';\n logSentryEnablesSourceMap('nitro.rollupConfig.output.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Disabled source map setting in the Nuxt config: `nitro.rollupConfig.output.sourcemapExcludeSources`. Source maps will include the actual code to be able to un-minify code snippets in Sentry.',\n );\n });\n\n return previousUserSourceMapSetting;\n}\n\nfunction logKeepSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${settingValue}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Parts of source map generation are currently disabled in your Nuxt 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 });\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n });\n}\n"],"names":[],"mappings":";;;;AAQA;AACA;AACA;;AAGA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAA2B,IAAI,EAAc;AAC1F,EAAE,MAAM,0BAA0B,aAAa,CAAC,uBAAwB,IAAG,EAAE;AAC7E,EAAE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ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { NitroConfig } from 'nitropack';\nimport type { OutputOptions } from 'rollup';\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/**\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 const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n const sourceMapsEnabled = sourceMapsUploadOptions.enabled ?? true;\n\n nuxt.hook('modules:done', () => {\n if (sourceMapsEnabled && !nuxt.options.dev) {\n changeNuxtSourceMapSettings(nuxt, moduleOptions);\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, _env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\n const previousUserSourceMapSetting = changeViteSourceMapSettings(viteConfig, moduleOptions);\n\n // Add Sentry plugin\n viteConfig.plugins = viteConfig.plugins || [];\n viteConfig.plugins.push(\n sentryVitePlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\n );\n }\n });\n\n nuxt.hook('nitro:config', (nitroConfig: NitroConfig) => {\n if (sourceMapsEnabled && !nitroConfig.dev) {\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 const previousUserSourceMapSetting = changeRollupSourceMapSettings(nitroConfig, moduleOptions);\n\n // Add Sentry plugin\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === 'unset')),\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 */\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n deleteFilesAfterUpload: boolean,\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n if (typeof sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload === 'undefined' && deleteFilesAfterUpload) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Setting `sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [\".*/**/public/**/*.map\"]` to delete generated source maps after they were uploaded to Sentry.',\n );\n });\n }\n\n return {\n org: sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n project: sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n authToken: sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n telemetry: sourceMapsUploadOptions.telemetry ?? true,\n url: sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n debug: moduleOptions.debug ?? false,\n silent: sourceMapsUploadOptions.silent ?? false,\n errorHandler: sourceMapsUploadOptions.errorHandler,\n release: {\n name: sourceMapsUploadOptions.release?.name,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\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 assets: sourceMapsUploadOptions.sourcemaps?.assets ?? undefined,\n ignore: sourceMapsUploadOptions.sourcemaps?.ignore ?? undefined,\n filesToDeleteAfterUpload: sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n ? sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload\n : deleteFilesAfterUpload\n ? ['.*/**/public/**/*.map']\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* There are 3 ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993)\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 Nuxt has 3 places to set source maps: vite options, rollup options, nuxt itself\n Ideally, all 3 are enabled to get all source maps.\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\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap');\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepSourceMapSetting(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 logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client');\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server');\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeViteSourceMapSettings(\n viteConfig: { build?: { sourcemap?: boolean | 'inline' | 'hidden' } },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n viteConfig.build = viteConfig.build || {};\n const viteSourceMap = viteConfig.build.sourcemap;\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n if (viteSourceMap === false) {\n warnExplicitlyDisabledSourceMap('vite.build.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'vite.build.sourcemap', viteSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n viteConfig.build.sourcemap = 'hidden';\n logSentryEnablesSourceMap('vite.build.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** only exported for testing */\nexport function changeRollupSourceMapSettings(\n nitroConfig: {\n rollupConfig?: {\n output?: {\n sourcemap?: OutputOptions['sourcemap'];\n sourcemapExcludeSources?: OutputOptions['sourcemapExcludeSources'];\n };\n };\n },\n sentryModuleOptions: SentryNuxtModuleOptions,\n): UserSourceMapSetting {\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n\n let previousUserSourceMapSetting: UserSourceMapSetting;\n\n const nitroSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n if (nitroSourceMap === false) {\n warnExplicitlyDisabledSourceMap('nitro.rollupConfig.output.sourcemap');\n previousUserSourceMapSetting = 'disabled';\n } else if (nitroSourceMap && ['hidden', 'inline', true].includes(nitroSourceMap)) {\n logKeepSourceMapSetting(sentryModuleOptions, 'nitro.rollupConfig.output.sourcemap', nitroSourceMap.toString());\n previousUserSourceMapSetting = 'enabled';\n } else {\n nitroConfig.rollupConfig.output.sourcemap = 'hidden';\n logSentryEnablesSourceMap('nitro.rollupConfig.output.sourcemap', 'hidden');\n previousUserSourceMapSetting = 'unset';\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Disabled source map setting in the Nuxt config: `nitro.rollupConfig.output.sourcemapExcludeSources`. Source maps will include the actual code to be able to un-minify code snippets in Sentry.',\n );\n });\n\n return previousUserSourceMapSetting;\n}\n\nfunction logKeepSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${settingValue}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Parts of source map generation are currently disabled in your Nuxt 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 });\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n });\n}\n"],"names":[],"mappings":";;;;AAQA;AACA;AACA;;AAGA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAA2B,IAAI,EAAc;AAC1F,EAAE,MAAM,0BAA0B,aAAa,CAAC,uBAAwB,IAAG,EAAE;AAC7E,EAAE,MAAM,iBAAkB,GAAE,uBAAuB,CAAC,OAAA,IAAW,IAAI;;AAEnE,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM;AAClC,IAAI,IAAI,iBAAA,IAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAChD,MAAM,2BAA2B,CAAC,IAAI,EAAE,aAAa,CAAC;AACtD;AAC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AAG;AACf,MAAM,yMAAyM;AAC/M,KAAK;AACL,GAAG,CAAC;;AAEJ,EAAE,OAAO,4BAA4B;AACrC;;AAEA,SAAS,uBAAuB;AAChC,EAAE,uBAAuB;AACzB,EAAE,UAAU;AACZ,EAAE,YAAY;AACd,EAAQ;AACR,EAAE,IAAI,uBAAuB,CAAC,KAAK,EAAE;AACrC,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,YAAY,CAAC,4GAA4G,CAAC;AAC1L,OAAO;AACP,KAAK,CAAC;AACN;AACA;;AAEA,SAAS,+BAA+B,CAAC,UAAU,EAAgB;AACnE,EAAE,cAAc,CAAC,MAAM;AACvB;AACA,IAAI,OAAO,CAAC,IAAI;AAChB,MAAM,CAAC,6FAA6F,EAAE,UAAU,CAAC,0QAA0Q,EAAE,UAAU,CAAC,wCAAwC,CAAC;AACjb,KAAK;AACL,GAAG,CAAC;AACJ;;AAEA,SAAS,yBAAyB,CAAC,UAAU,EAAU,YAAY,EAAgB;AACnF,EAAE,cAAc,CAAC,MAAM;AACvB;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,mEAAmE,EAAE,UAAU,CAAC,EAAE,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;AACvH,GAAG,CAAC;AACJ;;;;"}
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "9.9.0",
7
+ "version": "9.10.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -305,7 +305,6 @@ function getPluginOptions(moduleOptions, deleteFilesAfterUpload) {
305
305
  };
306
306
  }
307
307
  function changeNuxtSourceMapSettings(nuxt, sentryModuleOptions) {
308
- nuxt.options = nuxt.options || {};
309
308
  nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: void 0, client: void 0 };
310
309
  let previousUserSourceMapSetting = {
311
310
  client: void 0,
@@ -6,7 +6,7 @@ import type { ComponentPublicInstance } from 'vue';
6
6
  * Extracts the relevant context information from the error context (H3Event in Nitro Error)
7
7
  * and created a structured context object.
8
8
  */
9
- export declare function extractErrorContext(errorContext: CapturedErrorContext): Context;
9
+ export declare function extractErrorContext(errorContext: CapturedErrorContext | undefined): Context;
10
10
  /**
11
11
  * Adds Sentry tracing <meta> tags to the returned html page.
12
12
  *
@@ -1,20 +1,17 @@
1
- import { captureException, dropUndefinedKeys, getClient, getTraceMetaTags } from "@sentry/core";
1
+ import { captureException, getClient, getTraceMetaTags } from "@sentry/core";
2
2
  export function extractErrorContext(errorContext) {
3
- const structuredContext = {
4
- method: void 0,
5
- path: void 0,
6
- tags: void 0
7
- };
8
- if (errorContext) {
9
- if (errorContext.event) {
10
- structuredContext.method = errorContext.event._method || void 0;
11
- structuredContext.path = errorContext.event._path || void 0;
12
- }
13
- if (Array.isArray(errorContext.tags)) {
14
- structuredContext.tags = errorContext.tags || void 0;
15
- }
3
+ const ctx = {};
4
+ if (!errorContext) {
5
+ return ctx;
6
+ }
7
+ if (errorContext.event) {
8
+ ctx.method = errorContext.event._method;
9
+ ctx.path = errorContext.event._path;
10
+ }
11
+ if (Array.isArray(errorContext.tags)) {
12
+ ctx.tags = errorContext.tags;
16
13
  }
17
- return dropUndefinedKeys(structuredContext);
14
+ return ctx;
18
15
  }
19
16
  export function addSentryTracingMetaTags(head) {
20
17
  const metaTags = getTraceMetaTags();
@@ -1,6 +1,7 @@
1
1
  import type { Client, Integration, Options, StackParser } from '@sentry/core';
2
2
  import type { SentryNuxtClientOptions, SentryNuxtServerOptions } from './common/types';
3
3
  import type * as clientSdk from './index.client';
4
+ import type * as serverSdk from './index.server';
4
5
  export * from './index.client';
5
6
  export * from './index.server';
6
7
  export declare function init(options: Options | SentryNuxtClientOptions | SentryNuxtServerOptions): Client | undefined;
@@ -8,4 +9,5 @@ export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsInteg
8
9
  export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
9
10
  export declare const getDefaultIntegrations: (options: Options) => Integration[];
10
11
  export declare const defaultStackParser: StackParser;
12
+ export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
11
13
  //# sourceMappingURL=index.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../src/index.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAIjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,uBAAuB,GAAG,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAAC;AACvH,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,WAAW,EAAE,CAAC;AACjF,MAAM,CAAC,OAAO,CAAC,MAAM,kBAAkB,EAAE,WAAW,CAAC"}
1
+ {"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../src/index.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAIjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,uBAAuB,GAAG,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAAC;AACvH,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,WAAW,EAAE,CAAC;AACjF,MAAM,CAAC,OAAO,CAAC,MAAM,kBAAkB,EAAE,WAAW,CAAC;AAErD,MAAM,CAAC,OAAO,CAAC,MAAM,MAAM,EAAE,OAAO,SAAS,CAAC,MAAM,GAAG,OAAO,SAAS,CAAC,MAAM,CAAC"}
@@ -6,7 +6,7 @@ import type { ComponentPublicInstance } from 'vue';
6
6
  * Extracts the relevant context information from the error context (H3Event in Nitro Error)
7
7
  * and created a structured context object.
8
8
  */
9
- export declare function extractErrorContext(errorContext: CapturedErrorContext): Context;
9
+ export declare function extractErrorContext(errorContext: CapturedErrorContext | undefined): Context;
10
10
  /**
11
11
  * Adds Sentry tracing <meta> tags to the returned html page.
12
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,KAAK,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAmB/E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAMlF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAyBP"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,KAAK,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,oBAAoB,GAAG,SAAS,GAAG,OAAO,CAiB3F;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAMlF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAyBP"}
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.d.ts","sourceRoot":"","sources":["../../../src/vite/sourceMaps.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E;IACX,YAAY,CAAC,EAAE;QACb,MAAM,CAAC,EAAE;YACP,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;YACvC,uBAAuB,CAAC,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC;SACpE,CAAC;KACH,CAAC;CACH,EACD,mBAAmB,EAAE,uBAAuB,GAC3C,oBAAoB,CA6BtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "9.9.0",
3
+ "version": "9.10.1",
4
4
  "description": "Official Sentry SDK for Nuxt (EXPERIMENTAL)",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
@@ -43,13 +43,13 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@nuxt/kit": "^3.13.2",
46
- "@sentry/browser": "9.9.0",
47
- "@sentry/core": "9.9.0",
48
- "@sentry/node": "9.9.0",
49
- "@sentry/opentelemetry": "9.9.0",
50
- "@sentry/rollup-plugin": "3.1.2",
51
- "@sentry/vite-plugin": "2.22.6",
52
- "@sentry/vue": "9.9.0"
46
+ "@sentry/browser": "9.10.1",
47
+ "@sentry/core": "9.10.1",
48
+ "@sentry/node": "9.10.1",
49
+ "@sentry/opentelemetry": "9.10.1",
50
+ "@sentry/rollup-plugin": "3.2.4",
51
+ "@sentry/vite-plugin": "3.2.4",
52
+ "@sentry/vue": "9.10.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@nuxt/module-builder": "^0.8.4",