@sentry/nuxt 10.24.0 → 10.25.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.
@@ -1 +1 @@
1
- {"version":3,"file":"piniaIntegration.js","sources":["../../../src/client/piniaIntegration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { consoleSandbox, defineIntegration } from '@sentry/core';\nimport { createSentryPiniaPlugin } from '@sentry/vue';\n\nconst INTEGRATION_NAME = 'Pinia';\n\ntype Pinia = { use: (plugin: ReturnType<typeof createSentryPiniaPlugin>) => void };\n\nconst _piniaIntegration = ((\n // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`\n pinia: unknown | Pinia,\n options: Parameters<typeof createSentryPiniaPlugin>[0] = {},\n) => {\n return {\n name: INTEGRATION_NAME,\n setup() {\n if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `\"@pinia/nuxt\"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',\n pinia,\n );\n });\n } else {\n (pinia as Pinia).use(createSentryPiniaPlugin(options));\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Monitor an existing Pinia store.\n *\n * This only works if \"@pinia/nuxt\" is added to the `modules` array.\n */\nexport const piniaIntegration = defineIntegration(_piniaIntegration);\n"],"names":["consoleSandbox","createSentryPiniaPlugin","defineIntegration"],"mappings":";;;;;AAIA,MAAM,gBAAA,GAAmB,OAAO;;AAIhC,MAAM,iBAAA,IAAqB;AAC3B;AACA,EAAE,KAAK;AACP,EAAE,OAAO,GAAkD,EAAE;AAC7D,KAAK;AACL,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,GAAG;AACZ,MAAM,IAAI,CAAC,UAAU,OAAO,KAAA,KAAU,QAAA,IAAY,EAAE,KAAA,IAAS,KAAK,CAAC,CAAC,EAAE;AACtE,QAAQA,mBAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,uQAAuQ;AACnR,YAAY,KAAK;AACjB,WAAW;AACX,SAAS,CAAC;AACV,aAAa;AACb,QAAQ,CAAC,KAAA,GAAgB,GAAG,CAACC,2BAAuB,CAAC,OAAO,CAAC,CAAC;AAC9D;AACA,KAAK;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmBC,sBAAiB,CAAC,iBAAiB;;;;"}
1
+ {"version":3,"file":"piniaIntegration.js","sources":["../../../src/client/piniaIntegration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { consoleSandbox, defineIntegration } from '@sentry/core';\nimport { createSentryPiniaPlugin } from '@sentry/vue';\n\nconst INTEGRATION_NAME = 'Pinia';\n\ntype Pinia = { use: (plugin: ReturnType<typeof createSentryPiniaPlugin>) => void };\n\nconst _piniaIntegration = ((\n // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`\n pinia: unknown | Pinia,\n options: Parameters<typeof createSentryPiniaPlugin>[0] = {},\n) => {\n return {\n name: INTEGRATION_NAME,\n setup() {\n if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `\"@pinia/nuxt\"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',\n pinia,\n );\n });\n } else {\n (pinia as Pinia).use(createSentryPiniaPlugin(options));\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Monitor an existing Pinia store.\n *\n * This only works if \"@pinia/nuxt\" is added to the `modules` array.\n */\nexport const piniaIntegration = defineIntegration(_piniaIntegration);\n"],"names":["consoleSandbox","createSentryPiniaPlugin","defineIntegration"],"mappings":";;;;;AAIA,MAAM,gBAAA,GAAmB,OAAO;;AAIhC,MAAM,iBAAA,IAAqB;AAC3B;AACA,EAAE,KAAK;AACP,EAAE,OAAO,GAAkD,EAAE;AAC7D,KAAK;AACL,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,GAAG;AACZ,MAAM,IAAI,CAAC,UAAU,OAAO,KAAA,KAAU,QAAA,IAAY,EAAE,KAAA,IAAS,KAAK,CAAC,CAAC,EAAE;AACtE,QAAQA,mBAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,uQAAuQ;AACnR,YAAY,KAAK;AACjB,WAAW;AACX,QAAQ,CAAC,CAAC;AACV,MAAM,OAAO;AACb,QAAQ,CAAC,KAAA,GAAgB,GAAG,CAACC,2BAAuB,CAAC,OAAO,CAAC,CAAC;AAC9D,MAAM;AACN,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmBC,sBAAiB,CAAC,iBAAiB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"vueIntegration.js","sources":["../../../src/client/vueIntegration.ts"],"sourcesContent":["import { defineIntegration, GLOBAL_OBJ } from '@sentry/core';\nimport type { VueIntegrationOptions } from '@sentry/vue';\n\ntype Options = Omit<VueIntegrationOptions, 'app' | 'Vue'>;\n\n// Since the options object needs to cross the boundary between some builds (i.e. the nuxt module build and our client\n// SDK build) we cannot use a getter that is exported from here. Instead we'll pass the options object through a global\n// to the module.\nexport type GlobalObjWithIntegrationOptions = { _sentryNuxtVueIntegrationOptions?: Options };\n\n// The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available.\n// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away\n// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.\n\n/**\n * Add additional error and span instrumentation specialized for Vue.\n */\nexport const vueIntegration = defineIntegration((options: Options = {}) => {\n return {\n // NOTE: This name is different from the original vueIntegration's name.\n name: 'NuxtVueIntegration',\n setup() {\n (GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions = options;\n },\n };\n});\n"],"names":["defineIntegration","GLOBAL_OBJ"],"mappings":";;;;AAUA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,cAAA,GAAiBA,sBAAiB,CAAC,CAAC,OAAO,GAAY,EAAE,KAAK;AAC3E,EAAE,OAAO;AACT;AACA,IAAI,IAAI,EAAE,oBAAoB;AAC9B,IAAI,KAAK,GAAG;AACZ,MAAM,CAACC,eAAA,GAA+C,gCAAA,GAAmC,OAAO;AAChG,KAAK;AACL,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"vueIntegration.js","sources":["../../../src/client/vueIntegration.ts"],"sourcesContent":["import { defineIntegration, GLOBAL_OBJ } from '@sentry/core';\nimport type { VueIntegrationOptions } from '@sentry/vue';\n\ntype Options = Omit<VueIntegrationOptions, 'app' | 'Vue'>;\n\n// Since the options object needs to cross the boundary between some builds (i.e. the nuxt module build and our client\n// SDK build) we cannot use a getter that is exported from here. Instead we'll pass the options object through a global\n// to the module.\nexport type GlobalObjWithIntegrationOptions = { _sentryNuxtVueIntegrationOptions?: Options };\n\n// The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available.\n// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away\n// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.\n\n/**\n * Add additional error and span instrumentation specialized for Vue.\n */\nexport const vueIntegration = defineIntegration((options: Options = {}) => {\n return {\n // NOTE: This name is different from the original vueIntegration's name.\n name: 'NuxtVueIntegration',\n setup() {\n (GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions = options;\n },\n };\n});\n"],"names":["defineIntegration","GLOBAL_OBJ"],"mappings":";;;;AAUA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,cAAA,GAAiBA,sBAAiB,CAAC,CAAC,OAAO,GAAY,EAAE,KAAK;AAC3E,EAAE,OAAO;AACT;AACA,IAAI,IAAI,EAAE,oBAAoB;AAC9B,IAAI,KAAK,GAAG;AACZ,MAAM,CAACC,eAAA,GAA+C,gCAAA,GAAmC,OAAO;AAChG,IAAI,CAAC;AACL,GAAG;AACH,CAAC;;;;"}
@@ -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 // 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 const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\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);\n }\n\n nuxt.hooks.hook('nitro:init', nitro => {\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","addMiddlewareInstrumentation","consoleSandbox","addServerConfigToBuild","addSentryTopImport","addDynamicImportEntryFileWrapper"],"mappings":";;;;;;;;;;;AAoBA,iBAAeA,oBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;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AA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,aAAA,CAAA;AACA;AACA;AACA;AACA,KAAA,CAAA;AACA,GAAA;AACA,CAAA,CAAA;;;;"}
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 // 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 const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\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);\n }\n\n nuxt.hooks.hook('nitro:init', nitro => {\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","addMiddlewareInstrumentation","consoleSandbox","addServerConfigToBuild","addSentryTopImport","addDynamicImportEntryFileWrapper"],"mappings":";;;;;;;;;;;AAoBA,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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ACA,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
- {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport { applySdkMetadata, debug, flush, getGlobalScope, vercelWaitUntil } from '@sentry/core';\nimport {\n type NodeOptions,\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n} from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const sentryOptions = {\n ...options,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["applySdkMetadata","initNode","getGlobalScope","DEBUG_BUILD","debug","getDefaultNodeIntegrations","httpIntegration","vercelWaitUntil","flush"],"mappings":";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G,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE;AACA;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport { applySdkMetadata, debug, flush, getGlobalScope, vercelWaitUntil } from '@sentry/core';\nimport {\n type NodeOptions,\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n} from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const sentryOptions = {\n ...options,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["applySdkMetadata","initNode","getGlobalScope","DEBUG_BUILD","debug","getDefaultNodeIntegrations","httpIntegration","vercelWaitUntil","flush"],"mappings":";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C,EAAE;AACd,IAAID,sBAAA,IAAeC,UAAK,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE,EAAE;AACF;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"server-template.js","sources":["../../../src/vendor/server-template.ts"],"sourcesContent":["import { useNuxt } from '@nuxt/kit';\nimport type { NuxtTemplate } from 'nuxt/schema';\n\n/**\n * Adds a virtual file that can be used within the Nuxt Nitro server build.\n * Available in NuxtKit v4, so we are porting it here.\n * https://github.com/nuxt/nuxt/blob/d6df732eec1a3bd442bdb325b0335beb7e10cd64/packages/kit/src/template.ts#L55-L62\n */\nexport function addServerTemplate(template: NuxtTemplate): NuxtTemplate {\n const nuxt = useNuxt();\n if (template.filename) {\n nuxt.options.nitro.virtual = nuxt.options.nitro.virtual || {};\n nuxt.options.nitro.virtual[template.filename] = template.getContents;\n }\n\n return template;\n}\n"],"names":["useNuxt"],"mappings":";;;;AAGA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,QAAQ,EAA8B;AACxE,EAAE,MAAM,IAAA,GAAOA,WAAO,EAAE;AACxB,EAAE,IAAI,QAAQ,CAAC,QAAQ,EAAE;AACzB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,GAAU,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,IAAW,EAAE;AACjE,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAA,GAAI,QAAQ,CAAC,WAAW;AACxE;;AAEA,EAAE,OAAO,QAAQ;AACjB;;;;"}
1
+ {"version":3,"file":"server-template.js","sources":["../../../src/vendor/server-template.ts"],"sourcesContent":["import { useNuxt } from '@nuxt/kit';\nimport type { NuxtTemplate } from 'nuxt/schema';\n\n/**\n * Adds a virtual file that can be used within the Nuxt Nitro server build.\n * Available in NuxtKit v4, so we are porting it here.\n * https://github.com/nuxt/nuxt/blob/d6df732eec1a3bd442bdb325b0335beb7e10cd64/packages/kit/src/template.ts#L55-L62\n */\nexport function addServerTemplate(template: NuxtTemplate): NuxtTemplate {\n const nuxt = useNuxt();\n if (template.filename) {\n nuxt.options.nitro.virtual = nuxt.options.nitro.virtual || {};\n nuxt.options.nitro.virtual[template.filename] = template.getContents;\n }\n\n return template;\n}\n"],"names":["useNuxt"],"mappings":";;;;AAGA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,QAAQ,EAA8B;AACxE,EAAE,MAAM,IAAA,GAAOA,WAAO,EAAE;AACxB,EAAE,IAAI,QAAQ,CAAC,QAAQ,EAAE;AACzB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,GAAU,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,IAAW,EAAE;AACjE,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAA,GAAI,QAAQ,CAAC,WAAW;AACxE,EAAE;;AAEF,EAAE,OAAO,QAAQ;AACjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addServerConfig.js","sources":["../../../src/vite/addServerConfig.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { createResolver } from '@nuxt/kit';\nimport { debug } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport type { InputPluginOption } from 'rollup';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport {\n constructFunctionReExport,\n constructWrappedFunctionExportQuery,\n getFilenameFromNodeStartCommand,\n QUERY_END_INDICATOR,\n removeSentryQueryFromPath,\n SENTRY_REEXPORTED_FUNCTIONS,\n SENTRY_WRAPPED_ENTRY,\n SENTRY_WRAPPED_FUNCTIONS,\n} from './utils';\n\nconst SERVER_CONFIG_FILENAME = 'sentry.server.config';\n\n/**\n * Adds the `sentry.server.config.ts` file as `sentry.server.config.mjs` to the `.output` directory to be able to reference this file in the node --import option.\n *\n * By adding a Rollup plugin to the Nitro Rollup options, the Sentry server config is transpiled and emitted to the server build.\n */\nexport function addServerConfigToBuild(\n moduleOptions: SentryNuxtModuleOptions,\n nitro: Nitro,\n serverConfigFile: string,\n): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (rollupConfig?.plugins === null || rollupConfig?.plugins === undefined) {\n rollupConfig.plugins = [];\n } else if (!Array.isArray(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 rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(injectServerConfigPlugin(nitro, serverConfigFile, moduleOptions.debug));\n });\n}\n\n/**\n * Adds the Sentry server config import at the top of the server entry file to load the SDK on the server.\n * This is necessary for environments where modifying the node option `--import` is not possible.\n * However, only limited tracing instrumentation is supported when doing this.\n */\nexport function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void {\n nitro.hooks.hook('close', async () => {\n const fileNameFromCommand =\n nitro.options.commands.preview && getFilenameFromNodeStartCommand(nitro.options.commands.preview);\n\n // other presets ('node-server' or 'vercel') have an index.mjs\n const presetsWithServerFile = ['netlify'];\n\n const entryFileName = fileNameFromCommand\n ? fileNameFromCommand\n : typeof nitro.options.rollupConfig?.output.entryFileNames === 'string'\n ? nitro.options.rollupConfig?.output.entryFileNames\n : presetsWithServerFile.includes(nitro.options.preset)\n ? 'server.mjs'\n : 'index.mjs';\n\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const entryFilePath = serverDirResolver.resolve(entryFileName);\n\n try {\n fs.readFile(entryFilePath, 'utf8', (err, data) => {\n const updatedContent = `import './${SERVER_CONFIG_FILENAME}.mjs';\\n${data}`;\n\n fs.writeFile(entryFilePath, updatedContent, 'utf8', () => {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Successfully added the Sentry import to the server entry file \"\\`${entryFilePath}\\`\"`,\n );\n }\n });\n });\n } catch (err) {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] An error occurred when trying to add the Sentry import to the server entry file \"\\`${entryFilePath}\\`\":`,\n err,\n );\n }\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport function addDynamicImportEntryFileWrapper(\n nitro: Nitro,\n serverConfigFile: string,\n moduleOptions: Omit<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'>>,\n): void {\n if (!nitro.options.rollupConfig) {\n nitro.options.rollupConfig = { output: {} };\n }\n\n if (nitro.options.rollupConfig?.plugins === null || nitro.options.rollupConfig?.plugins === undefined) {\n nitro.options.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitro.options.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 nitro.options.rollupConfig.plugins = [nitro.options.rollupConfig.plugins];\n }\n\n nitro.options.rollupConfig.plugins.push(\n wrapEntryWithDynamicImport({\n resolvedSentryConfigPath: createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`),\n experimental_entrypointWrappedFunctions: moduleOptions.experimental_entrypointWrappedFunctions,\n }),\n );\n}\n\n/**\n * Rollup plugin to include the Sentry server configuration file to the server build output.\n */\nfunction injectServerConfigPlugin(nitro: Nitro, serverConfigFile: string, isDebug?: boolean): InputPluginOption {\n const filePrefix = '\\0virtual:sentry-server-config:';\n\n return {\n name: 'rollup-plugin-inject-sentry-server-config',\n\n buildStart() {\n const configPath = createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`);\n\n if (!existsSync(configPath)) {\n if (isDebug) {\n debug.log(`[Sentry] Sentry server config file not found: ${configPath}`);\n }\n return;\n }\n\n // Emitting a file adds it to the build output (Rollup is aware of the file, and we can later return the code in resolveId)\n this.emitFile({\n type: 'chunk',\n id: `${filePrefix}${serverConfigFile}`,\n fileName: `${SERVER_CONFIG_FILENAME}.mjs`,\n });\n },\n\n resolveId(source) {\n if (source.startsWith(filePrefix)) {\n const originalFilePath = source.replace(filePrefix, '');\n const configPath = createResolver(nitro.options.rootDir).resolve(`/${originalFilePath}`);\n\n return { id: configPath };\n }\n return null;\n },\n };\n}\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n */\nfunction wrapEntryWithDynamicImport({\n resolvedSentryConfigPath,\n experimental_entrypointWrappedFunctions,\n debug,\n}: {\n resolvedSentryConfigPath: string;\n experimental_entrypointWrappedFunctions: string[];\n debug?: boolean;\n}): InputPluginOption {\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${SERVER_CONFIG_FILENAME}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (source === 'import-in-the-middle/hook.mjs') {\n // We are importing \"import-in-the-middle\" in the returned code of the `load()` function below\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (options.isEntry && source.includes('.mjs') && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || resolution?.external) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(\n moduleInfo.exportedBindings,\n experimental_entrypointWrappedFunctions,\n debug,\n ),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedSentryConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n \"import 'import-in-the-middle/hook.mjs';\\n\" +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n"],"names":["getFilenameFromNodeStartCommand","createResolver","existsSync","debug","SENTRY_WRAPPED_ENTRY","constructWrappedFunctionExportQuery","QUERY_END_INDICATOR","removeSentryQueryFromPath","SENTRY_WRAPPED_FUNCTIONS","SENTRY_REEXPORTED_FUNCTIONS","constructFunctionReExport"],"mappings":";;;;;;;;AAkBA,MAAM,sBAAA,GAAyB,sBAAsB;;AAErD;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB;AACtC,EAAE,aAAa;AACf,EAAE,KAAK;AACP,EAAE,gBAAgB;AAClB,EAAQ;AACR,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC7D,IAAI,IAAI,YAAY,EAAE,OAAA,KAAY,IAAA,IAAQ,YAAY,EAAE,OAAA,KAAY,SAAS,EAAE;AAC/E,MAAM,YAAY,CAAC,OAAA,GAAU,EAAE;AAC/B,KAAI,MAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AACrD;AACA,MAAM,YAAY,CAAC,OAAA,GAAU,CAAC,YAAY,CAAC,OAAO,CAAC;AACnD;;AAEA,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;AACrG,GAAG,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,aAAa,EAA2B,KAAK,EAAe;AAC/F,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY;AACxC,IAAI,MAAM,mBAAA;AACV,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAA,IAAWA,qCAA+B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;;AAEvG;AACA,IAAI,MAAM,qBAAA,GAAwB,CAAC,SAAS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A;AACA,QAAA,MAAA,OAAA,GAAAG,+BAAA,CAAA,EAAA,CAAA,CAAA,KAAA,CAAA,kBAAA,CAAA,MAAA,CAAA;;AAEA;AACA,QAAA,MAAA,mBAAA;AACA,UAAA,EAAA,CAAA,QAAA,CAAAC,8BAAA,CAAA,IAAA,EAAA,CAAA,QAAA,CAAAC,iCAAA;AACA,cAAAC,+BAAA,CAAA,EAAA,EAAA,OAAA;AACA,cAAA,EAAA;;AAEA,QAAA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,wBAAA,CAAA,CAAA,GAAA,CAAA;AACA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA;AACA,UAAA,2CAAA;AACA,UAAA,CAAA,EAAA,mBAAA,CAAA,EAAA;AACA;AACA;;AAEA,MAAA,OAAA,IAAA;AACA,KAAA;AACA,GAAA;AACA;;;;;;"}
1
+ {"version":3,"file":"addServerConfig.js","sources":["../../../src/vite/addServerConfig.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { createResolver } from '@nuxt/kit';\nimport { debug } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport type { InputPluginOption } from 'rollup';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport {\n constructFunctionReExport,\n constructWrappedFunctionExportQuery,\n getFilenameFromNodeStartCommand,\n QUERY_END_INDICATOR,\n removeSentryQueryFromPath,\n SENTRY_REEXPORTED_FUNCTIONS,\n SENTRY_WRAPPED_ENTRY,\n SENTRY_WRAPPED_FUNCTIONS,\n} from './utils';\n\nconst SERVER_CONFIG_FILENAME = 'sentry.server.config';\n\n/**\n * Adds the `sentry.server.config.ts` file as `sentry.server.config.mjs` to the `.output` directory to be able to reference this file in the node --import option.\n *\n * By adding a Rollup plugin to the Nitro Rollup options, the Sentry server config is transpiled and emitted to the server build.\n */\nexport function addServerConfigToBuild(\n moduleOptions: SentryNuxtModuleOptions,\n nitro: Nitro,\n serverConfigFile: string,\n): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (rollupConfig?.plugins === null || rollupConfig?.plugins === undefined) {\n rollupConfig.plugins = [];\n } else if (!Array.isArray(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 rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(injectServerConfigPlugin(nitro, serverConfigFile, moduleOptions.debug));\n });\n}\n\n/**\n * Adds the Sentry server config import at the top of the server entry file to load the SDK on the server.\n * This is necessary for environments where modifying the node option `--import` is not possible.\n * However, only limited tracing instrumentation is supported when doing this.\n */\nexport function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void {\n nitro.hooks.hook('close', async () => {\n const fileNameFromCommand =\n nitro.options.commands.preview && getFilenameFromNodeStartCommand(nitro.options.commands.preview);\n\n // other presets ('node-server' or 'vercel') have an index.mjs\n const presetsWithServerFile = ['netlify'];\n\n const entryFileName = fileNameFromCommand\n ? fileNameFromCommand\n : typeof nitro.options.rollupConfig?.output.entryFileNames === 'string'\n ? nitro.options.rollupConfig?.output.entryFileNames\n : presetsWithServerFile.includes(nitro.options.preset)\n ? 'server.mjs'\n : 'index.mjs';\n\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const entryFilePath = serverDirResolver.resolve(entryFileName);\n\n try {\n fs.readFile(entryFilePath, 'utf8', (err, data) => {\n const updatedContent = `import './${SERVER_CONFIG_FILENAME}.mjs';\\n${data}`;\n\n fs.writeFile(entryFilePath, updatedContent, 'utf8', () => {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Successfully added the Sentry import to the server entry file \"\\`${entryFilePath}\\`\"`,\n );\n }\n });\n });\n } catch (err) {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] An error occurred when trying to add the Sentry import to the server entry file \"\\`${entryFilePath}\\`\":`,\n err,\n );\n }\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport function addDynamicImportEntryFileWrapper(\n nitro: Nitro,\n serverConfigFile: string,\n moduleOptions: Omit<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'>>,\n): void {\n if (!nitro.options.rollupConfig) {\n nitro.options.rollupConfig = { output: {} };\n }\n\n if (nitro.options.rollupConfig?.plugins === null || nitro.options.rollupConfig?.plugins === undefined) {\n nitro.options.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitro.options.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 nitro.options.rollupConfig.plugins = [nitro.options.rollupConfig.plugins];\n }\n\n nitro.options.rollupConfig.plugins.push(\n wrapEntryWithDynamicImport({\n resolvedSentryConfigPath: createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`),\n experimental_entrypointWrappedFunctions: moduleOptions.experimental_entrypointWrappedFunctions,\n }),\n );\n}\n\n/**\n * Rollup plugin to include the Sentry server configuration file to the server build output.\n */\nfunction injectServerConfigPlugin(nitro: Nitro, serverConfigFile: string, isDebug?: boolean): InputPluginOption {\n const filePrefix = '\\0virtual:sentry-server-config:';\n\n return {\n name: 'rollup-plugin-inject-sentry-server-config',\n\n buildStart() {\n const configPath = createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`);\n\n if (!existsSync(configPath)) {\n if (isDebug) {\n debug.log(`[Sentry] Sentry server config file not found: ${configPath}`);\n }\n return;\n }\n\n // Emitting a file adds it to the build output (Rollup is aware of the file, and we can later return the code in resolveId)\n this.emitFile({\n type: 'chunk',\n id: `${filePrefix}${serverConfigFile}`,\n fileName: `${SERVER_CONFIG_FILENAME}.mjs`,\n });\n },\n\n resolveId(source) {\n if (source.startsWith(filePrefix)) {\n const originalFilePath = source.replace(filePrefix, '');\n const configPath = createResolver(nitro.options.rootDir).resolve(`/${originalFilePath}`);\n\n return { id: configPath };\n }\n return null;\n },\n };\n}\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n */\nfunction wrapEntryWithDynamicImport({\n resolvedSentryConfigPath,\n experimental_entrypointWrappedFunctions,\n debug,\n}: {\n resolvedSentryConfigPath: string;\n experimental_entrypointWrappedFunctions: string[];\n debug?: boolean;\n}): InputPluginOption {\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${SERVER_CONFIG_FILENAME}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (source === 'import-in-the-middle/hook.mjs') {\n // We are importing \"import-in-the-middle\" in the returned code of the `load()` function below\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (options.isEntry && source.includes('.mjs') && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || resolution?.external) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(\n moduleInfo.exportedBindings,\n experimental_entrypointWrappedFunctions,\n debug,\n ),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedSentryConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n \"import 'import-in-the-middle/hook.mjs';\\n\" +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n"],"names":["getFilenameFromNodeStartCommand","createResolver","existsSync","debug","SENTRY_WRAPPED_ENTRY","constructWrappedFunctionExportQuery","QUERY_END_INDICATOR","removeSentryQueryFromPath","SENTRY_WRAPPED_FUNCTIONS","SENTRY_REEXPORTED_FUNCTIONS","constructFunctionReExport"],"mappings":";;;;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A,CAAA,kBAAA,CAAA,MAAA,CAAA;;AAEA;AACA,QAAA,MAAA,mBAAA;AACA,UAAA,EAAA,CAAA,QAAA,CAAAC,8BAAA,CAAA,IAAA,EAAA,CAAA,QAAA,CAAAC,iCAAA;AACA,cAAAC,+BAAA,CAAA,EAAA,EAAA,OAAA;AACA,cAAA,EAAA;;AAEA,QAAA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,wBAAA,CAAA,CAAA,GAAA,CAAA;AACA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA;AACA,UAAA,2CAAA;AACA,UAAA,CAAA,EAAA,mBAAA,CAAA,EAAA;AACA;AACA,MAAA;;AAEA,MAAA,OAAA,IAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig): void {\n if (!nitro.experimental?.database) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":["consoleSandbox","addServerTemplate","addServerPlugin","createResolver"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAqB;AACrE,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC,IAAIA,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,uGAAuG;AAC/G,OAAO;AACP,KAAK,CAAC;;AAEN,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAEC,gCAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,KAAK;AACL,GAAG,CAAC;;AAEJ,EAAEC,mBAAe,CAACC,kBAAc,CAAC,wQAAe,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
1
+ {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig): void {\n if (!nitro.experimental?.database) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":["consoleSandbox","addServerTemplate","addServerPlugin","createResolver"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAqB;AACrE,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC,IAAIA,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,uGAAuG;AAC/G,OAAO;AACP,IAAI,CAAC,CAAC;;AAEN,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAEC,gCAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAEC,mBAAe,CAACC,kBAAc,CAAC,wQAAe,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"middlewareConfig.js","sources":["../../../src/vite/middlewareConfig.ts"],"sourcesContent":["import { addServerImports, createResolver } from '@nuxt/kit';\nimport type { Nitro } from 'nitropack/types';\nimport * as path from 'path';\nimport type { InputPluginOption } from 'rollup';\n\n/**\n * Adds a server import for the middleware instrumentation.\n */\nexport function addMiddlewareImports(): void {\n addServerImports([\n {\n name: 'wrapMiddlewareHandlerWithSentry',\n from: createResolver(import.meta.url).resolve('./runtime/hooks/wrapMiddlewareHandler'),\n },\n ]);\n}\n\n/**\n * Adds middleware instrumentation to the Nitro build.\n *\n * @param nitro Nitro instance\n */\nexport function addMiddlewareInstrumentation(nitro: Nitro): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (!rollupConfig.plugins) {\n rollupConfig.plugins = [];\n }\n\n if (!Array.isArray(rollupConfig.plugins)) {\n rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(middlewareInstrumentationPlugin(nitro));\n });\n}\n\n/**\n * Creates a rollup plugin for the middleware instrumentation by transforming the middleware code.\n *\n * @param nitro Nitro instance\n * @returns The rollup plugin for the middleware instrumentation.\n */\nfunction middlewareInstrumentationPlugin(nitro: Nitro): InputPluginOption {\n const middlewareFiles = new Set<string>();\n\n return {\n name: 'sentry-nuxt-middleware-instrumentation',\n buildStart() {\n // Collect middleware files during build start\n nitro.scannedHandlers?.forEach(({ middleware, handler }) => {\n if (middleware && handler) {\n middlewareFiles.add(handler);\n }\n });\n },\n transform(code: string, id: string) {\n // Only transform files we've identified as middleware\n if (middlewareFiles.has(id)) {\n const fileName = path.basename(id);\n return {\n code: wrapMiddlewareCode(code, fileName),\n map: null,\n };\n }\n return null;\n },\n };\n}\n\n/**\n * Wraps the middleware user code to instrument it.\n *\n * @param originalCode The original user code of the middleware.\n * @param fileName The name of the middleware file, used for the span name and logging.\n *\n * @returns The wrapped user code of the middleware.\n */\nfunction wrapMiddlewareCode(originalCode: string, fileName: string): string {\n // Remove common file extensions\n const cleanFileName = fileName.replace(/\\.(ts|js|mjs|mts|cts)$/, '');\n\n return `\nimport { wrapMiddlewareHandlerWithSentry } from '#imports';\n\nfunction defineInstrumentedEventHandler(handlerOrObject) {\n return defineEventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\nfunction instrumentedEventHandler(handlerOrObject) {\n return eventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\n${originalCode\n .replace(/defineEventHandler\\(/g, 'defineInstrumentedEventHandler(')\n .replace(/eventHandler\\(/g, 'instrumentedEventHandler(')}\n`;\n}\n"],"names":["addServerImports","createResolver"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,SAAS,oBAAoB,GAAS;AAC7C,EAAEA,oBAAgB,CAAC;AACnB,IAAI;AACJ,MAAM,IAAI,EAAE,iCAAiC;AAC7C,MAAM,IAAI,EAAEC,kBAAc,CAAC,0QAAe,CAAC,CAAC,OAAO,CAAC,uCAAuC,CAAC;AAC5F,KAAK;AACL,GAAG,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,KAAK,EAAe;AACjE,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC7D,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;AAC/B,MAAM,YAAY,CAAC,OAAA,GAAU,EAAE;AAC/B;;AAEA,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AAC9C,MAAM,YAAY,CAAC,OAAA,GAAU,CAAC,YAAY,CAAC,OAAO,CAAC;AACnD;;AAEA,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC;AACrE,GAAG,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,+BAA+B,CAAC,KAAK,EAA4B;AAC1E,EAAE,MAAM,eAAA,GAAkB,IAAI,GAAG,EAAU;;AAE3C,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,wCAAwC;AAClD,IAAI,UAAU,GAAG;AACjB;AACA,MAAM,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,OAAA,EAAS,KAAK;AAClE,QAAQ,IAAI,UAAA,IAAc,OAAO,EAAE;AACnC,UAAU,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC;AACtC;AACA,OAAO,CAAC;AACR,KAAK;AACL,IAAI,SAAS,CAAC,IAAI,EAAU,EAAE,EAAU;AACxC;AACA,MAAM,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;AACnC,QAAQ,MAAM,WAAW,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC1C,QAAQ,OAAO;AACf,UAAU,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC;AAClD,UAAU,GAAG,EAAE,IAAI;AACnB,SAAS;AACT;AACA,MAAM,OAAO,IAAI;AACjB,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,YAAY,EAAU,QAAQ,EAAkB;AAC5E;AACA,EAAE,MAAM,aAAA,GAAgB,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC;;AAEtE,EAAE,OAAO;AACT;;AAEA;AACA,8EAA8E,EAAE,aAAa,CAAC;AAC9F;;AAEA;AACA,wEAAwE,EAAE,aAAa,CAAC;AACxF;;AAEA,EAAE;AACF,GAAG,OAAO,CAAC,uBAAuB,EAAE,iCAAiC;AACrE,GAAG,OAAO,CAAC,iBAAiB,EAAE,2BAA2B,CAAC;AAC1D,CAAC;AACD;;;;;"}
1
+ {"version":3,"file":"middlewareConfig.js","sources":["../../../src/vite/middlewareConfig.ts"],"sourcesContent":["import { addServerImports, createResolver } from '@nuxt/kit';\nimport type { Nitro } from 'nitropack/types';\nimport * as path from 'path';\nimport type { InputPluginOption } from 'rollup';\n\n/**\n * Adds a server import for the middleware instrumentation.\n */\nexport function addMiddlewareImports(): void {\n addServerImports([\n {\n name: 'wrapMiddlewareHandlerWithSentry',\n from: createResolver(import.meta.url).resolve('./runtime/hooks/wrapMiddlewareHandler'),\n },\n ]);\n}\n\n/**\n * Adds middleware instrumentation to the Nitro build.\n *\n * @param nitro Nitro instance\n */\nexport function addMiddlewareInstrumentation(nitro: Nitro): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (!rollupConfig.plugins) {\n rollupConfig.plugins = [];\n }\n\n if (!Array.isArray(rollupConfig.plugins)) {\n rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(middlewareInstrumentationPlugin(nitro));\n });\n}\n\n/**\n * Creates a rollup plugin for the middleware instrumentation by transforming the middleware code.\n *\n * @param nitro Nitro instance\n * @returns The rollup plugin for the middleware instrumentation.\n */\nfunction middlewareInstrumentationPlugin(nitro: Nitro): InputPluginOption {\n const middlewareFiles = new Set<string>();\n\n return {\n name: 'sentry-nuxt-middleware-instrumentation',\n buildStart() {\n // Collect middleware files during build start\n nitro.scannedHandlers?.forEach(({ middleware, handler }) => {\n if (middleware && handler) {\n middlewareFiles.add(handler);\n }\n });\n },\n transform(code: string, id: string) {\n // Only transform files we've identified as middleware\n if (middlewareFiles.has(id)) {\n const fileName = path.basename(id);\n return {\n code: wrapMiddlewareCode(code, fileName),\n map: null,\n };\n }\n return null;\n },\n };\n}\n\n/**\n * Wraps the middleware user code to instrument it.\n *\n * @param originalCode The original user code of the middleware.\n * @param fileName The name of the middleware file, used for the span name and logging.\n *\n * @returns The wrapped user code of the middleware.\n */\nfunction wrapMiddlewareCode(originalCode: string, fileName: string): string {\n // Remove common file extensions\n const cleanFileName = fileName.replace(/\\.(ts|js|mjs|mts|cts)$/, '');\n\n return `\nimport { wrapMiddlewareHandlerWithSentry } from '#imports';\n\nfunction defineInstrumentedEventHandler(handlerOrObject) {\n return defineEventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\nfunction instrumentedEventHandler(handlerOrObject) {\n return eventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\n${originalCode\n .replace(/defineEventHandler\\(/g, 'defineInstrumentedEventHandler(')\n .replace(/eventHandler\\(/g, 'instrumentedEventHandler(')}\n`;\n}\n"],"names":["addServerImports","createResolver"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,SAAS,oBAAoB,GAAS;AAC7C,EAAEA,oBAAgB,CAAC;AACnB,IAAI;AACJ,MAAM,IAAI,EAAE,iCAAiC;AAC7C,MAAM,IAAI,EAAEC,kBAAc,CAAC,0QAAe,CAAC,CAAC,OAAO,CAAC,uCAAuC,CAAC;AAC5F,KAAK;AACL,GAAG,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,KAAK,EAAe;AACjE,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC7D,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;AAC/B,MAAM,YAAY,CAAC,OAAA,GAAU,EAAE;AAC/B,IAAI;;AAEJ,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AAC9C,MAAM,YAAY,CAAC,OAAA,GAAU,CAAC,YAAY,CAAC,OAAO,CAAC;AACnD,IAAI;;AAEJ,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC;AACrE,EAAE,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,+BAA+B,CAAC,KAAK,EAA4B;AAC1E,EAAE,MAAM,eAAA,GAAkB,IAAI,GAAG,EAAU;;AAE3C,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,wCAAwC;AAClD,IAAI,UAAU,GAAG;AACjB;AACA,MAAM,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,OAAA,EAAS,KAAK;AAClE,QAAQ,IAAI,UAAA,IAAc,OAAO,EAAE;AACnC,UAAU,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC;AACtC,QAAQ;AACR,MAAM,CAAC,CAAC;AACR,IAAI,CAAC;AACL,IAAI,SAAS,CAAC,IAAI,EAAU,EAAE,EAAU;AACxC;AACA,MAAM,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;AACnC,QAAQ,MAAM,WAAW,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC1C,QAAQ,OAAO;AACf,UAAU,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC;AAClD,UAAU,GAAG,EAAE,IAAI;AACnB,SAAS;AACT,MAAM;AACN,MAAM,OAAO,IAAI;AACjB,IAAI,CAAC;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,YAAY,EAAU,QAAQ,EAAkB;AAC5E;AACA,EAAE,MAAM,aAAA,GAAgB,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC;;AAEtE,EAAE,OAAO;AACT;;AAEA;AACA,8EAA8E,EAAE,aAAa,CAAC;AAC9F;;AAEA;AACA,wEAAwE,EAAE,aAAa,CAAC;AACxF;;AAEA,EAAE;AACF,GAAG,OAAO,CAAC,uBAAuB,EAAE,iCAAiC;AACrE,GAAG,OAAO,CAAC,iBAAiB,EAAE,2BAA2B,CAAC;AAC1D,CAAC;AACD;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } 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) {\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 (\n isDebug &&\n !moduleOptions.sourcemaps?.filesToDeleteAfterUpload &&\n // eslint-disable-next-line deprecation/deprecation\n !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload &&\n (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)\n ) {\n // eslint-disable-next-line no-console\n console.log(\n \"[Sentry] As Sentry enabled `'hidden'` source maps, source maps will be automatically deleted after uploading them to Sentry.\",\n );\n }\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\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) {\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;A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A,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 { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } 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) {\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 (\n isDebug &&\n !moduleOptions.sourcemaps?.filesToDeleteAfterUpload &&\n // eslint-disable-next-line deprecation/deprecation\n !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload &&\n (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)\n ) {\n // eslint-disable-next-line no-console\n console.log(\n \"[Sentry] As Sentry enabled `'hidden'` source maps, source maps will be automatically deleted after uploading them to Sentry.\",\n );\n }\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\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) {\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,IAAW,IAAI,CAAC;;AAEnD;AACA,EAAE,IAAI,yBAAA,GAA4B,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAA,EAAM;;AAEhE,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM;AAClC,IAAI,IAAI,iBAAA,IAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAChD;AACA;AACA;AACA;;AAEA;AACA,MAAM,MAAM,4BAA4B,2BAA2B,CAAC,IAAI,EAAE,aAAa,CAAC;;AAExF,MAAM,4BAA4B;AAClC,QAAQ,MAAM,EAAE,yBAAyB,CAAC,MAAA,KAAW,OAAO;AAC5D,QAAQ,MAAM,EAAE,yBAAyB,CAAC,MAAA,KAAW,OAAO;AAC5D,OAAO;;AAEP,MAAM;AACN,QAAQ,OAAA;AACR,QAAQ,C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,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 +1 @@
1
- {"version":3,"file":"storageConfig.js","sources":["../../../src/vite/storageConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport type { Nuxt } from 'nuxt/schema';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Prepares the storage config export to be used in the runtime storage instrumentation.\n */\nexport function addStorageInstrumentation(nuxt: Nuxt): void {\n const moduleDirResolver = createResolver(import.meta.url);\n const userStorageMounts = Object.keys(nuxt.options.nitro.storage || {});\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/storage-config.mjs',\n getContents: () => {\n return `export const userStorageMounts = ${JSON.stringify(userStorageMounts)};`;\n },\n });\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage.server'));\n}\n"],"names":["createResolver","addServerTemplate","addServerPlugin"],"mappings":";;;;;;AAIA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,IAAI,EAAc;AAC5D,EAAE,MAAM,iBAAA,GAAoBA,kBAAc,CAAC,uQAAe,CAAC;AAC3D,EAAE,MAAM,iBAAA,GAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;;AAEzE;AACA,EAAEC,gCAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,4BAA4B;AAC1C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,iCAAiC,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACrF,KAAK;AACL,GAAG,CAAC;;AAEJ,EAAEC,mBAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAChF;;;;"}
1
+ {"version":3,"file":"storageConfig.js","sources":["../../../src/vite/storageConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport type { Nuxt } from 'nuxt/schema';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Prepares the storage config export to be used in the runtime storage instrumentation.\n */\nexport function addStorageInstrumentation(nuxt: Nuxt): void {\n const moduleDirResolver = createResolver(import.meta.url);\n const userStorageMounts = Object.keys(nuxt.options.nitro.storage || {});\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/storage-config.mjs',\n getContents: () => {\n return `export const userStorageMounts = ${JSON.stringify(userStorageMounts)};`;\n },\n });\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage.server'));\n}\n"],"names":["createResolver","addServerTemplate","addServerPlugin"],"mappings":";;;;;;AAIA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,IAAI,EAAc;AAC5D,EAAE,MAAM,iBAAA,GAAoBA,kBAAc,CAAC,uQAAe,CAAC;AAC3D,EAAE,MAAM,iBAAA,GAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;;AAEzE;AACA,EAAEC,gCAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,4BAA4B;AAC1C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,iCAAiC,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACrF,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAEC,mBAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAChF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nuxt } from 'nuxt/schema';\nimport * as path from 'path';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const cwd = process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch?.[1]\n ?.split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n const reexport =\n reexportMatch?.[1]\n ?.split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n \"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt): void {\n if (!nuxt.options.dev) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":["consoleSandbox"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAAuB,IAAI,EAA6B;AACnG,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACzE,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,IAAA,KAAS,QAAQ,EAAE;AACzB,IAAI,KAAK,MAAM,GAAA,IAAO,sBAAsB,EAAE;AAC9C,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAA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AAA,OAAA,CAAA,KAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,GAAA,EAAA;AACA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,GAAA,6CAAA;AACA;AACA;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nuxt } from 'nuxt/schema';\nimport * as path from 'path';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const cwd = process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch?.[1]\n ?.split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n const reexport =\n reexportMatch?.[1]\n ?.split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n \"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt): void {\n if (!nuxt.options.dev) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":["consoleSandbox"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAAuB,IAAI,EAA6B;AACnG,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACzE,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,IAAA,KAAS,QAAQ,EAAE;AACzB,IAAI,KAAK,MAAM,GAAA,IAAO,sBAAsB,EAAE;AAC9C,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA,CAAA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AAA,CAAA,GAAA,EAAA;AACA,IAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,GAAA,EAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,GAAA,6CAAA;AACA,EAAA;AACA;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"piniaIntegration.js","sources":["../../../src/client/piniaIntegration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { consoleSandbox, defineIntegration } from '@sentry/core';\nimport { createSentryPiniaPlugin } from '@sentry/vue';\n\nconst INTEGRATION_NAME = 'Pinia';\n\ntype Pinia = { use: (plugin: ReturnType<typeof createSentryPiniaPlugin>) => void };\n\nconst _piniaIntegration = ((\n // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`\n pinia: unknown | Pinia,\n options: Parameters<typeof createSentryPiniaPlugin>[0] = {},\n) => {\n return {\n name: INTEGRATION_NAME,\n setup() {\n if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `\"@pinia/nuxt\"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',\n pinia,\n );\n });\n } else {\n (pinia as Pinia).use(createSentryPiniaPlugin(options));\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Monitor an existing Pinia store.\n *\n * This only works if \"@pinia/nuxt\" is added to the `modules` array.\n */\nexport const piniaIntegration = defineIntegration(_piniaIntegration);\n"],"names":[],"mappings":";;;AAIA,MAAM,gBAAA,GAAmB,OAAO;;AAIhC,MAAM,iBAAA,IAAqB;AAC3B;AACA,EAAE,KAAK;AACP,EAAE,OAAO,GAAkD,EAAE;AAC7D,KAAK;AACL,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,GAAG;AACZ,MAAM,IAAI,CAAC,UAAU,OAAO,KAAA,KAAU,QAAA,IAAY,EAAE,KAAA,IAAS,KAAK,CAAC,CAAC,EAAE;AACtE,QAAQ,cAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,uQAAuQ;AACnR,YAAY,KAAK;AACjB,WAAW;AACX,SAAS,CAAC;AACV,aAAa;AACb,QAAQ,CAAC,KAAA,GAAgB,GAAG,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9D;AACA,KAAK;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmB,iBAAiB,CAAC,iBAAiB;;;;"}
1
+ {"version":3,"file":"piniaIntegration.js","sources":["../../../src/client/piniaIntegration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { consoleSandbox, defineIntegration } from '@sentry/core';\nimport { createSentryPiniaPlugin } from '@sentry/vue';\n\nconst INTEGRATION_NAME = 'Pinia';\n\ntype Pinia = { use: (plugin: ReturnType<typeof createSentryPiniaPlugin>) => void };\n\nconst _piniaIntegration = ((\n // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`\n pinia: unknown | Pinia,\n options: Parameters<typeof createSentryPiniaPlugin>[0] = {},\n) => {\n return {\n name: INTEGRATION_NAME,\n setup() {\n if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `\"@pinia/nuxt\"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',\n pinia,\n );\n });\n } else {\n (pinia as Pinia).use(createSentryPiniaPlugin(options));\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Monitor an existing Pinia store.\n *\n * This only works if \"@pinia/nuxt\" is added to the `modules` array.\n */\nexport const piniaIntegration = defineIntegration(_piniaIntegration);\n"],"names":[],"mappings":";;;AAIA,MAAM,gBAAA,GAAmB,OAAO;;AAIhC,MAAM,iBAAA,IAAqB;AAC3B;AACA,EAAE,KAAK;AACP,EAAE,OAAO,GAAkD,EAAE;AAC7D,KAAK;AACL,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,GAAG;AACZ,MAAM,IAAI,CAAC,UAAU,OAAO,KAAA,KAAU,QAAA,IAAY,EAAE,KAAA,IAAS,KAAK,CAAC,CAAC,EAAE;AACtE,QAAQ,cAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,uQAAuQ;AACnR,YAAY,KAAK;AACjB,WAAW;AACX,QAAQ,CAAC,CAAC;AACV,MAAM,OAAO;AACb,QAAQ,CAAC,KAAA,GAAgB,GAAG,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9D,MAAM;AACN,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmB,iBAAiB,CAAC,iBAAiB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"vueIntegration.js","sources":["../../../src/client/vueIntegration.ts"],"sourcesContent":["import { defineIntegration, GLOBAL_OBJ } from '@sentry/core';\nimport type { VueIntegrationOptions } from '@sentry/vue';\n\ntype Options = Omit<VueIntegrationOptions, 'app' | 'Vue'>;\n\n// Since the options object needs to cross the boundary between some builds (i.e. the nuxt module build and our client\n// SDK build) we cannot use a getter that is exported from here. Instead we'll pass the options object through a global\n// to the module.\nexport type GlobalObjWithIntegrationOptions = { _sentryNuxtVueIntegrationOptions?: Options };\n\n// The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available.\n// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away\n// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.\n\n/**\n * Add additional error and span instrumentation specialized for Vue.\n */\nexport const vueIntegration = defineIntegration((options: Options = {}) => {\n return {\n // NOTE: This name is different from the original vueIntegration's name.\n name: 'NuxtVueIntegration',\n setup() {\n (GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions = options;\n },\n };\n});\n"],"names":[],"mappings":";;AAUA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,cAAA,GAAiB,iBAAiB,CAAC,CAAC,OAAO,GAAY,EAAE,KAAK;AAC3E,EAAE,OAAO;AACT;AACA,IAAI,IAAI,EAAE,oBAAoB;AAC9B,IAAI,KAAK,GAAG;AACZ,MAAM,CAAC,UAAA,GAA+C,gCAAA,GAAmC,OAAO;AAChG,KAAK;AACL,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"vueIntegration.js","sources":["../../../src/client/vueIntegration.ts"],"sourcesContent":["import { defineIntegration, GLOBAL_OBJ } from '@sentry/core';\nimport type { VueIntegrationOptions } from '@sentry/vue';\n\ntype Options = Omit<VueIntegrationOptions, 'app' | 'Vue'>;\n\n// Since the options object needs to cross the boundary between some builds (i.e. the nuxt module build and our client\n// SDK build) we cannot use a getter that is exported from here. Instead we'll pass the options object through a global\n// to the module.\nexport type GlobalObjWithIntegrationOptions = { _sentryNuxtVueIntegrationOptions?: Options };\n\n// The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available.\n// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away\n// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.\n\n/**\n * Add additional error and span instrumentation specialized for Vue.\n */\nexport const vueIntegration = defineIntegration((options: Options = {}) => {\n return {\n // NOTE: This name is different from the original vueIntegration's name.\n name: 'NuxtVueIntegration',\n setup() {\n (GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions = options;\n },\n };\n});\n"],"names":[],"mappings":";;AAUA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,cAAA,GAAiB,iBAAiB,CAAC,CAAC,OAAO,GAAY,EAAE,KAAK;AAC3E,EAAE,OAAO;AACT;AACA,IAAI,IAAI,EAAE,oBAAoB;AAC9B,IAAI,KAAK,GAAG;AACZ,MAAM,CAAC,UAAA,GAA+C,gCAAA,GAAmC,OAAO;AAChG,IAAI,CAAC;AACL,GAAG;AACH,CAAC;;;;"}
@@ -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 // 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 const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\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);\n }\n\n nuxt.hooks.hook('nitro:init', nitro => {\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,eAAe,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,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,KAAA,CAAA;AACA,GAAA;AACA,CAAA,CAAA;;;;"}
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 // 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 const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\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);\n }\n\n nuxt.hooks.hook('nitro:init', nitro => {\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,eAAe,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,QAAQ,QAAQ;AACh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A,CAAA,QAAA,CAAA,KAAA,CAAA,OAAA,CAAA,OAAA,EAAA,gBAAA,CAAA,CAAA,CAAA;;AAEA,YAAA,cAAA,CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,CAAA,iBAAA,EAAA,gBAAA,CAAA,sSAAA,CAAA;AACA,eAAA;;AAEA,cAAA,IAAA,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,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.24.0"}
1
+ {"type":"module","version":"10.25.0"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport { applySdkMetadata, debug, flush, getGlobalScope, vercelWaitUntil } from '@sentry/core';\nimport {\n type NodeOptions,\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n} from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const sentryOptions = {\n ...options,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["initNode","getDefaultNodeIntegrations"],"mappings":";;;;;AAYA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,gBAAgB;AACxB,IAAI,GAAG,OAAO;AACd,IAAI,mBAAmB,EAAE,0BAA0B,CAAC,OAAO,CAAC;AAC5D,GAAG;;AAEH,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;AAE3D,EAAE,MAAM,MAAA,GAASA,MAAQ,CAAC,aAAa,CAAC;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AQ,OAAO,CAAC,KAAA,IAAS,WAAA,IAAe,KAAK,CAAC,GAAG,CAAC,iDAAiD,EAAE,QAAQ,CAAC;AAC9G,QAAQ,OAAO,IAAI;AACnB;AACA,MAAM,OAAO,KAAK;AAClB,KAAK;AACL,IAAI,EAAE,EAAE,EAAE,gCAAA,EAAkC;AAC5C,GAAG;AACH;;AAEA,SAAS,0BAA0B,CAAC,OAAO,EAA8B;AACzE,EAAE,OAAO;AACT,IAAI,GAAGC,sBAA0B,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,WAAA,IAAe,WAAW,CAAC,IAAA,KAAS,MAAM,CAAC;AAC7F;AACA,IAAI,eAAe,CAAC;AACpB,MAAM,eAAe,EAAE;AACvB,QAAQ,YAAY,EAAE,MAAM;AAC5B;AACA,UAAU,eAAe,CAAC,sBAAsB,EAAE,CAAC;AACnD,SAAS;AACT,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;AAEA;AACA;AACA;AACA,eAAe,sBAAsB,GAAkB;AACvD,EAAE,IAAI;AACN,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAClD,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC;AACrB,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACpD,GAAE,CAAE,OAAO,CAAC,EAAE;AACd,IAAI,WAAA,IAAe,KAAK,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE;AACA;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport { applySdkMetadata, debug, flush, getGlobalScope, vercelWaitUntil } from '@sentry/core';\nimport {\n type NodeOptions,\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n} from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const sentryOptions = {\n ...options,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["initNode","getDefaultNodeIntegrations"],"mappings":";;;;;AAYA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,gBAAgB;AACxB,IAAI,GAAG,OAAO;AACd,IAAI,mBAAmB,EAAE,0BAA0B,CAAC,OAAO,CAAC;AAC5D,GAAG;;AAEH,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;AAE3D,EAAE,MAAM,MAAA,GAASA,MAAQ,CAAC,aAAa,CAAC;;AAExC,EAAE,cAAc,EAAE,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAC3E,EAAE,cAA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D,EAAE,QAAQ,CAAC;AAC9G,QAAQ,OAAO,IAAI;AACnB,MAAM;AACN,MAAM,OAAO,KAAK;AAClB,IAAI,CAAC;AACL,IAAI,EAAE,EAAE,EAAE,gCAAA,EAAkC;AAC5C,GAAG;AACH;;AAEA,SAAS,0BAA0B,CAAC,OAAO,EAA8B;AACzE,EAAE,OAAO;AACT,IAAI,GAAGC,sBAA0B,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,WAAA,IAAe,WAAW,CAAC,IAAA,KAAS,MAAM,CAAC;AAC7F;AACA,IAAI,eAAe,CAAC;AACpB,MAAM,eAAe,EAAE;AACvB,QAAQ,YAAY,EAAE,MAAM;AAC5B;AACA,UAAU,eAAe,CAAC,sBAAsB,EAAE,CAAC;AACnD,QAAQ,CAAC;AACT,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;AAEA;AACA;AACA;AACA,eAAe,sBAAsB,GAAkB;AACvD,EAAE,IAAI;AACN,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAClD,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC;AACrB,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACpD,EAAE,CAAA,CAAE,OAAO,CAAC,EAAE;AACd,IAAI,WAAA,IAAe,KAAK,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE,EAAE;AACF;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"server-template.js","sources":["../../../src/vendor/server-template.ts"],"sourcesContent":["import { useNuxt } from '@nuxt/kit';\nimport type { NuxtTemplate } from 'nuxt/schema';\n\n/**\n * Adds a virtual file that can be used within the Nuxt Nitro server build.\n * Available in NuxtKit v4, so we are porting it here.\n * https://github.com/nuxt/nuxt/blob/d6df732eec1a3bd442bdb325b0335beb7e10cd64/packages/kit/src/template.ts#L55-L62\n */\nexport function addServerTemplate(template: NuxtTemplate): NuxtTemplate {\n const nuxt = useNuxt();\n if (template.filename) {\n nuxt.options.nitro.virtual = nuxt.options.nitro.virtual || {};\n nuxt.options.nitro.virtual[template.filename] = template.getContents;\n }\n\n return template;\n}\n"],"names":[],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,QAAQ,EAA8B;AACxE,EAAE,MAAM,IAAA,GAAO,OAAO,EAAE;AACxB,EAAE,IAAI,QAAQ,CAAC,QAAQ,EAAE;AACzB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,GAAU,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,IAAW,EAAE;AACjE,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAA,GAAI,QAAQ,CAAC,WAAW;AACxE;;AAEA,EAAE,OAAO,QAAQ;AACjB;;;;"}
1
+ {"version":3,"file":"server-template.js","sources":["../../../src/vendor/server-template.ts"],"sourcesContent":["import { useNuxt } from '@nuxt/kit';\nimport type { NuxtTemplate } from 'nuxt/schema';\n\n/**\n * Adds a virtual file that can be used within the Nuxt Nitro server build.\n * Available in NuxtKit v4, so we are porting it here.\n * https://github.com/nuxt/nuxt/blob/d6df732eec1a3bd442bdb325b0335beb7e10cd64/packages/kit/src/template.ts#L55-L62\n */\nexport function addServerTemplate(template: NuxtTemplate): NuxtTemplate {\n const nuxt = useNuxt();\n if (template.filename) {\n nuxt.options.nitro.virtual = nuxt.options.nitro.virtual || {};\n nuxt.options.nitro.virtual[template.filename] = template.getContents;\n }\n\n return template;\n}\n"],"names":[],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,QAAQ,EAA8B;AACxE,EAAE,MAAM,IAAA,GAAO,OAAO,EAAE;AACxB,EAAE,IAAI,QAAQ,CAAC,QAAQ,EAAE;AACzB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,GAAU,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAA,IAAW,EAAE;AACjE,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAA,GAAI,QAAQ,CAAC,WAAW;AACxE,EAAE;;AAEF,EAAE,OAAO,QAAQ;AACjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addServerConfig.js","sources":["../../../src/vite/addServerConfig.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { createResolver } from '@nuxt/kit';\nimport { debug } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport type { InputPluginOption } from 'rollup';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport {\n constructFunctionReExport,\n constructWrappedFunctionExportQuery,\n getFilenameFromNodeStartCommand,\n QUERY_END_INDICATOR,\n removeSentryQueryFromPath,\n SENTRY_REEXPORTED_FUNCTIONS,\n SENTRY_WRAPPED_ENTRY,\n SENTRY_WRAPPED_FUNCTIONS,\n} from './utils';\n\nconst SERVER_CONFIG_FILENAME = 'sentry.server.config';\n\n/**\n * Adds the `sentry.server.config.ts` file as `sentry.server.config.mjs` to the `.output` directory to be able to reference this file in the node --import option.\n *\n * By adding a Rollup plugin to the Nitro Rollup options, the Sentry server config is transpiled and emitted to the server build.\n */\nexport function addServerConfigToBuild(\n moduleOptions: SentryNuxtModuleOptions,\n nitro: Nitro,\n serverConfigFile: string,\n): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (rollupConfig?.plugins === null || rollupConfig?.plugins === undefined) {\n rollupConfig.plugins = [];\n } else if (!Array.isArray(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 rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(injectServerConfigPlugin(nitro, serverConfigFile, moduleOptions.debug));\n });\n}\n\n/**\n * Adds the Sentry server config import at the top of the server entry file to load the SDK on the server.\n * This is necessary for environments where modifying the node option `--import` is not possible.\n * However, only limited tracing instrumentation is supported when doing this.\n */\nexport function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void {\n nitro.hooks.hook('close', async () => {\n const fileNameFromCommand =\n nitro.options.commands.preview && getFilenameFromNodeStartCommand(nitro.options.commands.preview);\n\n // other presets ('node-server' or 'vercel') have an index.mjs\n const presetsWithServerFile = ['netlify'];\n\n const entryFileName = fileNameFromCommand\n ? fileNameFromCommand\n : typeof nitro.options.rollupConfig?.output.entryFileNames === 'string'\n ? nitro.options.rollupConfig?.output.entryFileNames\n : presetsWithServerFile.includes(nitro.options.preset)\n ? 'server.mjs'\n : 'index.mjs';\n\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const entryFilePath = serverDirResolver.resolve(entryFileName);\n\n try {\n fs.readFile(entryFilePath, 'utf8', (err, data) => {\n const updatedContent = `import './${SERVER_CONFIG_FILENAME}.mjs';\\n${data}`;\n\n fs.writeFile(entryFilePath, updatedContent, 'utf8', () => {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Successfully added the Sentry import to the server entry file \"\\`${entryFilePath}\\`\"`,\n );\n }\n });\n });\n } catch (err) {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] An error occurred when trying to add the Sentry import to the server entry file \"\\`${entryFilePath}\\`\":`,\n err,\n );\n }\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport function addDynamicImportEntryFileWrapper(\n nitro: Nitro,\n serverConfigFile: string,\n moduleOptions: Omit<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'>>,\n): void {\n if (!nitro.options.rollupConfig) {\n nitro.options.rollupConfig = { output: {} };\n }\n\n if (nitro.options.rollupConfig?.plugins === null || nitro.options.rollupConfig?.plugins === undefined) {\n nitro.options.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitro.options.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 nitro.options.rollupConfig.plugins = [nitro.options.rollupConfig.plugins];\n }\n\n nitro.options.rollupConfig.plugins.push(\n wrapEntryWithDynamicImport({\n resolvedSentryConfigPath: createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`),\n experimental_entrypointWrappedFunctions: moduleOptions.experimental_entrypointWrappedFunctions,\n }),\n );\n}\n\n/**\n * Rollup plugin to include the Sentry server configuration file to the server build output.\n */\nfunction injectServerConfigPlugin(nitro: Nitro, serverConfigFile: string, isDebug?: boolean): InputPluginOption {\n const filePrefix = '\\0virtual:sentry-server-config:';\n\n return {\n name: 'rollup-plugin-inject-sentry-server-config',\n\n buildStart() {\n const configPath = createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`);\n\n if (!existsSync(configPath)) {\n if (isDebug) {\n debug.log(`[Sentry] Sentry server config file not found: ${configPath}`);\n }\n return;\n }\n\n // Emitting a file adds it to the build output (Rollup is aware of the file, and we can later return the code in resolveId)\n this.emitFile({\n type: 'chunk',\n id: `${filePrefix}${serverConfigFile}`,\n fileName: `${SERVER_CONFIG_FILENAME}.mjs`,\n });\n },\n\n resolveId(source) {\n if (source.startsWith(filePrefix)) {\n const originalFilePath = source.replace(filePrefix, '');\n const configPath = createResolver(nitro.options.rootDir).resolve(`/${originalFilePath}`);\n\n return { id: configPath };\n }\n return null;\n },\n };\n}\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n */\nfunction wrapEntryWithDynamicImport({\n resolvedSentryConfigPath,\n experimental_entrypointWrappedFunctions,\n debug,\n}: {\n resolvedSentryConfigPath: string;\n experimental_entrypointWrappedFunctions: string[];\n debug?: boolean;\n}): InputPluginOption {\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${SERVER_CONFIG_FILENAME}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (source === 'import-in-the-middle/hook.mjs') {\n // We are importing \"import-in-the-middle\" in the returned code of the `load()` function below\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (options.isEntry && source.includes('.mjs') && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || resolution?.external) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(\n moduleInfo.exportedBindings,\n experimental_entrypointWrappedFunctions,\n debug,\n ),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedSentryConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n \"import 'import-in-the-middle/hook.mjs';\\n\" +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n"],"names":[],"mappings":";;;;;;AAkBA,MAAM,sBAAA,GAAyB,sBAAsB;;AAErD;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB;AACtC,EAAE,aAAa;AACf,EAAE,KAAK;AACP,EAAE,gBAAgB;AAClB,EAAQ;AACR,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC7D,IAAI,IAAI,YAAY,EAAE,OAAA,KAAY,IAAA,IAAQ,YAAY,EAAE,OAAA,KAAY,SAAS,EAAE;AAC/E,MAAM,YAAY,CAAC,OAAA,GAAU,EAAE;AAC/B,KAAI,MAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAA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,GAAA,IAAA;;AAEA;AACA,QAAA,OAAA,UAAA,CAAA,EAAA,CAAA,QAAA,CAAA,CAAA,IAAA,EAAA,oBAAA,CAAA,CAAA;AACA,YAAA,UAAA,CAAA;AACA,YAAA,CAAA,EAAA,kBAAA,CAAA,EAAA,UAAA,CAAA;AACA;AACA,eAAA,MAAA,CAAA,oBAAA;AACA,eAAA,MAAA;AACA,gBAAA,mCAAA;AACA,kBAAA,UAAA,CAAA,gBAAA;AACA,kBAAA,uCAAA;AACA,kBAAA,KAAA;AACA,iBAAA;AACA;AACA,eAAA,MAAA,CAAA,mBAAA,CAAA,CAAA,CAAA;AACA;AACA,MAAA,OAAA,IAAA;AACA,KAAA;AACA,IAAA,IAAA,CAAA,EAAA,EAAA;AACA,MAAA,IAAA,EAAA,CAAA,QAAA,CAAA,CAAA,IAAA,EAAA,oBAAA,CAAA,CAAA,CAAA,EAAA;AACA,QAAA,MAAA,OAAA,GAAA,yBAAA,CAAA,EAAA,CAAA,CAAA,KAAA,CAAA,kBAAA,CAAA,MAAA,CAAA;;AAEA;AACA,QAAA,MAAA,mBAAA;AACA,UAAA,EAAA,CAAA,QAAA,CAAA,wBAAA,CAAA,IAAA,EAAA,CAAA,QAAA,CAAA,2BAAA;AACA,cAAA,yBAAA,CAAA,EAAA,EAAA,OAAA;AACA,cAAA,EAAA;;AAEA,QAAA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,wBAAA,CAAA,CAAA,GAAA,CAAA;AACA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA;AACA,UAAA,2CAAA;AACA,UAAA,CAAA,EAAA,mBAAA,CAAA,EAAA;AACA;AACA;;AAEA,MAAA,OAAA,IAAA;AACA,KAAA;AACA,GAAA;AACA;;;;"}
1
+ {"version":3,"file":"addServerConfig.js","sources":["../../../src/vite/addServerConfig.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { createResolver } from '@nuxt/kit';\nimport { debug } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport type { InputPluginOption } from 'rollup';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport {\n constructFunctionReExport,\n constructWrappedFunctionExportQuery,\n getFilenameFromNodeStartCommand,\n QUERY_END_INDICATOR,\n removeSentryQueryFromPath,\n SENTRY_REEXPORTED_FUNCTIONS,\n SENTRY_WRAPPED_ENTRY,\n SENTRY_WRAPPED_FUNCTIONS,\n} from './utils';\n\nconst SERVER_CONFIG_FILENAME = 'sentry.server.config';\n\n/**\n * Adds the `sentry.server.config.ts` file as `sentry.server.config.mjs` to the `.output` directory to be able to reference this file in the node --import option.\n *\n * By adding a Rollup plugin to the Nitro Rollup options, the Sentry server config is transpiled and emitted to the server build.\n */\nexport function addServerConfigToBuild(\n moduleOptions: SentryNuxtModuleOptions,\n nitro: Nitro,\n serverConfigFile: string,\n): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (rollupConfig?.plugins === null || rollupConfig?.plugins === undefined) {\n rollupConfig.plugins = [];\n } else if (!Array.isArray(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 rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(injectServerConfigPlugin(nitro, serverConfigFile, moduleOptions.debug));\n });\n}\n\n/**\n * Adds the Sentry server config import at the top of the server entry file to load the SDK on the server.\n * This is necessary for environments where modifying the node option `--import` is not possible.\n * However, only limited tracing instrumentation is supported when doing this.\n */\nexport function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void {\n nitro.hooks.hook('close', async () => {\n const fileNameFromCommand =\n nitro.options.commands.preview && getFilenameFromNodeStartCommand(nitro.options.commands.preview);\n\n // other presets ('node-server' or 'vercel') have an index.mjs\n const presetsWithServerFile = ['netlify'];\n\n const entryFileName = fileNameFromCommand\n ? fileNameFromCommand\n : typeof nitro.options.rollupConfig?.output.entryFileNames === 'string'\n ? nitro.options.rollupConfig?.output.entryFileNames\n : presetsWithServerFile.includes(nitro.options.preset)\n ? 'server.mjs'\n : 'index.mjs';\n\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const entryFilePath = serverDirResolver.resolve(entryFileName);\n\n try {\n fs.readFile(entryFilePath, 'utf8', (err, data) => {\n const updatedContent = `import './${SERVER_CONFIG_FILENAME}.mjs';\\n${data}`;\n\n fs.writeFile(entryFilePath, updatedContent, 'utf8', () => {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Successfully added the Sentry import to the server entry file \"\\`${entryFilePath}\\`\"`,\n );\n }\n });\n });\n } catch (err) {\n if (moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] An error occurred when trying to add the Sentry import to the server entry file \"\\`${entryFilePath}\\`\":`,\n err,\n );\n }\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport function addDynamicImportEntryFileWrapper(\n nitro: Nitro,\n serverConfigFile: string,\n moduleOptions: Omit<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'>>,\n): void {\n if (!nitro.options.rollupConfig) {\n nitro.options.rollupConfig = { output: {} };\n }\n\n if (nitro.options.rollupConfig?.plugins === null || nitro.options.rollupConfig?.plugins === undefined) {\n nitro.options.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitro.options.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 nitro.options.rollupConfig.plugins = [nitro.options.rollupConfig.plugins];\n }\n\n nitro.options.rollupConfig.plugins.push(\n wrapEntryWithDynamicImport({\n resolvedSentryConfigPath: createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`),\n experimental_entrypointWrappedFunctions: moduleOptions.experimental_entrypointWrappedFunctions,\n }),\n );\n}\n\n/**\n * Rollup plugin to include the Sentry server configuration file to the server build output.\n */\nfunction injectServerConfigPlugin(nitro: Nitro, serverConfigFile: string, isDebug?: boolean): InputPluginOption {\n const filePrefix = '\\0virtual:sentry-server-config:';\n\n return {\n name: 'rollup-plugin-inject-sentry-server-config',\n\n buildStart() {\n const configPath = createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`);\n\n if (!existsSync(configPath)) {\n if (isDebug) {\n debug.log(`[Sentry] Sentry server config file not found: ${configPath}`);\n }\n return;\n }\n\n // Emitting a file adds it to the build output (Rollup is aware of the file, and we can later return the code in resolveId)\n this.emitFile({\n type: 'chunk',\n id: `${filePrefix}${serverConfigFile}`,\n fileName: `${SERVER_CONFIG_FILENAME}.mjs`,\n });\n },\n\n resolveId(source) {\n if (source.startsWith(filePrefix)) {\n const originalFilePath = source.replace(filePrefix, '');\n const configPath = createResolver(nitro.options.rootDir).resolve(`/${originalFilePath}`);\n\n return { id: configPath };\n }\n return null;\n },\n };\n}\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n */\nfunction wrapEntryWithDynamicImport({\n resolvedSentryConfigPath,\n experimental_entrypointWrappedFunctions,\n debug,\n}: {\n resolvedSentryConfigPath: string;\n experimental_entrypointWrappedFunctions: string[];\n debug?: boolean;\n}): InputPluginOption {\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${SERVER_CONFIG_FILENAME}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (source === 'import-in-the-middle/hook.mjs') {\n // We are importing \"import-in-the-middle\" in the returned code of the `load()` function below\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (options.isEntry && source.includes('.mjs') && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || resolution?.external) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(\n moduleInfo.exportedBindings,\n experimental_entrypointWrappedFunctions,\n debug,\n ),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedSentryConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n \"import 'import-in-the-middle/hook.mjs';\\n\" +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n"],"names":[],"mappings":";;;;;;AAkBA,MAAM,sBAAA,GAAyB,sBAAsB;;AAErD;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB;AACtC,EAAE,aAAa;AACf,EAAE,KAAK;AACP,EAAE,gBAAgB;AAClB,EAAQ;AACR,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC7D,IAAI,IAAI,YAAY,EAAE,OAAA,KAAY,IAAA,IAAQ,YAAY,EAAE,OAAA,KAAY,SAAS,EAAE;AAC/E,MAAM,YAAY,CAAC,OAAA,GAAU,EAAE;AAC/B,IAAI,CAAA,MAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AACrD;AACA,MAAM,YAAY,CAAC,OAAA,GAAU,CAAC,YAAY,CAAC,OAAO,CAAC;AACnD,IAAI;;AAEJ,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;AACrG,EAAE,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,aAAa,EAA2B,KAAK,EAAe;AAC/F,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY;AACxC,IAAI,MA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AA;AACA,kBAAA,uCAAA;AACA,kBAAA,KAAA;AACA,iBAAA;AACA;AACA,eAAA,MAAA,CAAA,mBAAA,CAAA,CAAA,CAAA;AACA,MAAA;AACA,MAAA,OAAA,IAAA;AACA,IAAA,CAAA;AACA,IAAA,IAAA,CAAA,EAAA,EAAA;AACA,MAAA,IAAA,EAAA,CAAA,QAAA,CAAA,CAAA,IAAA,EAAA,oBAAA,CAAA,CAAA,CAAA,EAAA;AACA,QAAA,MAAA,OAAA,GAAA,yBAAA,CAAA,EAAA,CAAA,CAAA,KAAA,CAAA,kBAAA,CAAA,MAAA,CAAA;;AAEA;AACA,QAAA,MAAA,mBAAA;AACA,UAAA,EAAA,CAAA,QAAA,CAAA,wBAAA,CAAA,IAAA,EAAA,CAAA,QAAA,CAAA,2BAAA;AACA,cAAA,yBAAA,CAAA,EAAA,EAAA,OAAA;AACA,cAAA,EAAA;;AAEA,QAAA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,wBAAA,CAAA,CAAA,GAAA,CAAA;AACA;AACA;AACA,UAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA;AACA,UAAA,2CAAA;AACA,UAAA,CAAA,EAAA,mBAAA,CAAA,EAAA;AACA;AACA,MAAA;;AAEA,MAAA,OAAA,IAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig): void {\n if (!nitro.experimental?.database) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAqB;AACrE,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,uGAAuG;AAC/G,OAAO;AACP,KAAK,CAAC;;AAEN,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAE,iBAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,KAAK;AACL,GAAG,CAAC;;AAEJ,EAAE,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
1
+ {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig): void {\n if (!nitro.experimental?.database) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAqB;AACrE,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,uGAAuG;AAC/G,OAAO;AACP,IAAI,CAAC,CAAC;;AAEN,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAE,iBAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAE,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"middlewareConfig.js","sources":["../../../src/vite/middlewareConfig.ts"],"sourcesContent":["import { addServerImports, createResolver } from '@nuxt/kit';\nimport type { Nitro } from 'nitropack/types';\nimport * as path from 'path';\nimport type { InputPluginOption } from 'rollup';\n\n/**\n * Adds a server import for the middleware instrumentation.\n */\nexport function addMiddlewareImports(): void {\n addServerImports([\n {\n name: 'wrapMiddlewareHandlerWithSentry',\n from: createResolver(import.meta.url).resolve('./runtime/hooks/wrapMiddlewareHandler'),\n },\n ]);\n}\n\n/**\n * Adds middleware instrumentation to the Nitro build.\n *\n * @param nitro Nitro instance\n */\nexport function addMiddlewareInstrumentation(nitro: Nitro): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (!rollupConfig.plugins) {\n rollupConfig.plugins = [];\n }\n\n if (!Array.isArray(rollupConfig.plugins)) {\n rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(middlewareInstrumentationPlugin(nitro));\n });\n}\n\n/**\n * Creates a rollup plugin for the middleware instrumentation by transforming the middleware code.\n *\n * @param nitro Nitro instance\n * @returns The rollup plugin for the middleware instrumentation.\n */\nfunction middlewareInstrumentationPlugin(nitro: Nitro): InputPluginOption {\n const middlewareFiles = new Set<string>();\n\n return {\n name: 'sentry-nuxt-middleware-instrumentation',\n buildStart() {\n // Collect middleware files during build start\n nitro.scannedHandlers?.forEach(({ middleware, handler }) => {\n if (middleware && handler) {\n middlewareFiles.add(handler);\n }\n });\n },\n transform(code: string, id: string) {\n // Only transform files we've identified as middleware\n if (middlewareFiles.has(id)) {\n const fileName = path.basename(id);\n return {\n code: wrapMiddlewareCode(code, fileName),\n map: null,\n };\n }\n return null;\n },\n };\n}\n\n/**\n * Wraps the middleware user code to instrument it.\n *\n * @param originalCode The original user code of the middleware.\n * @param fileName The name of the middleware file, used for the span name and logging.\n *\n * @returns The wrapped user code of the middleware.\n */\nfunction wrapMiddlewareCode(originalCode: string, fileName: string): string {\n // Remove common file extensions\n const cleanFileName = fileName.replace(/\\.(ts|js|mjs|mts|cts)$/, '');\n\n return `\nimport { wrapMiddlewareHandlerWithSentry } from '#imports';\n\nfunction defineInstrumentedEventHandler(handlerOrObject) {\n return defineEventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\nfunction instrumentedEventHandler(handlerOrObject) {\n return eventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\n${originalCode\n .replace(/defineEventHandler\\(/g, 'defineInstrumentedEventHandler(')\n .replace(/eventHandler\\(/g, 'instrumentedEventHandler(')}\n`;\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACO,SAAS,oBAAoB,GAAS;AAC7C,EAAE,gBAAgB,CAAC;AACnB,IAAI;AACJ,MAAM,IAAI,EAAE,iCAAiC;AAC7C,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,uCAAuC,CAAC;AAC5F,KAAK;AACL,GAAG,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,KAAK,EAAe;AACjE,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC7D,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;AAC/B,MAAM,YAAY,CAAC,OAAA,GAAU,EAAE;AAC/B;;AAEA,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AAC9C,MAAM,YAAY,CAAC,OAAA,GAAU,CAAC,YAAY,CAAC,OAAO,CAAC;AACnD;;AAEA,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CA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B,CAAC;AAC1D,CAAC;AACD;;;;"}
1
+ {"version":3,"file":"middlewareConfig.js","sources":["../../../src/vite/middlewareConfig.ts"],"sourcesContent":["import { addServerImports, createResolver } from '@nuxt/kit';\nimport type { Nitro } from 'nitropack/types';\nimport * as path from 'path';\nimport type { InputPluginOption } from 'rollup';\n\n/**\n * Adds a server import for the middleware instrumentation.\n */\nexport function addMiddlewareImports(): void {\n addServerImports([\n {\n name: 'wrapMiddlewareHandlerWithSentry',\n from: createResolver(import.meta.url).resolve('./runtime/hooks/wrapMiddlewareHandler'),\n },\n ]);\n}\n\n/**\n * Adds middleware instrumentation to the Nitro build.\n *\n * @param nitro Nitro instance\n */\nexport function addMiddlewareInstrumentation(nitro: Nitro): void {\n nitro.hooks.hook('rollup:before', (nitro, rollupConfig) => {\n if (!rollupConfig.plugins) {\n rollupConfig.plugins = [];\n }\n\n if (!Array.isArray(rollupConfig.plugins)) {\n rollupConfig.plugins = [rollupConfig.plugins];\n }\n\n rollupConfig.plugins.push(middlewareInstrumentationPlugin(nitro));\n });\n}\n\n/**\n * Creates a rollup plugin for the middleware instrumentation by transforming the middleware code.\n *\n * @param nitro Nitro instance\n * @returns The rollup plugin for the middleware instrumentation.\n */\nfunction middlewareInstrumentationPlugin(nitro: Nitro): InputPluginOption {\n const middlewareFiles = new Set<string>();\n\n return {\n name: 'sentry-nuxt-middleware-instrumentation',\n buildStart() {\n // Collect middleware files during build start\n nitro.scannedHandlers?.forEach(({ middleware, handler }) => {\n if (middleware && handler) {\n middlewareFiles.add(handler);\n }\n });\n },\n transform(code: string, id: string) {\n // Only transform files we've identified as middleware\n if (middlewareFiles.has(id)) {\n const fileName = path.basename(id);\n return {\n code: wrapMiddlewareCode(code, fileName),\n map: null,\n };\n }\n return null;\n },\n };\n}\n\n/**\n * Wraps the middleware user code to instrument it.\n *\n * @param originalCode The original user code of the middleware.\n * @param fileName The name of the middleware file, used for the span name and logging.\n *\n * @returns The wrapped user code of the middleware.\n */\nfunction wrapMiddlewareCode(originalCode: string, fileName: string): string {\n // Remove common file extensions\n const cleanFileName = fileName.replace(/\\.(ts|js|mjs|mts|cts)$/, '');\n\n return `\nimport { wrapMiddlewareHandlerWithSentry } from '#imports';\n\nfunction defineInstrumentedEventHandler(handlerOrObject) {\n return defineEventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\nfunction instrumentedEventHandler(handlerOrObject) {\n return eventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));\n}\n\n${originalCode\n .replace(/defineEventHandler\\(/g, 'defineInstrumentedEventHandler(')\n .replace(/eventHandler\\(/g, 'instrumentedEventHandler(')}\n`;\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACO,SAAS,oBAAoB,GAAS;AAC7C,EAAE,gBAAgB,CAAC;AACnB,IAAI;AACJ,MAAM,IAAI,EAAE,iCAAiC;AAC7C,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,uCAAuC,CAAC;AAC5F,KAAK;AACL,GAAG,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,KAAK,EAAe;AACjE,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC7D,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;AAC/B,MAAM,YAAY,CAAC,OAAA,GAAU,EAAE;AAC/B,IAAI;;AAEJ,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AAC9C,MAAM,YAAY,CAAC,OAAA,GAAU,CAAC,YAAY,CAAC,OAAO,CAAC;AACnD,IAAI;;AAEJ,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC;AACrE,EAAE,CAAC,CAAC;AACJ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;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } 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) {\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 (\n isDebug &&\n !moduleOptions.sourcemaps?.filesToDeleteAfterUpload &&\n // eslint-disable-next-line deprecation/deprecation\n !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload &&\n (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)\n ) {\n // eslint-disable-next-line no-console\n console.log(\n \"[Sentry] As Sentry enabled `'hidden'` source maps, source maps will be automatically deleted after uploading them to Sentry.\",\n );\n }\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\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) {\n if (!nitroConfig.rollupConfig) {\n nitroConfig.rollupConfig = {};\n }\n\n if (nitroConfig.rollupConfig.plugins === null || nitroConfig.rollupConfig.plugins === undefined) {\n nitroConfig.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitroConfig.rollupConfig.plugins)) {\n // `rollupConfig.plugins` can be a single plugin, so we want to put it into an array so that we can push our own plugin\n nitroConfig.rollupConfig.plugins = [nitroConfig.rollupConfig.plugins];\n }\n\n validateNitroSourceMapSettings(nuxt, nitroConfig, moduleOptions);\n\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log('[Sentry] Adding Sentry Rollup plugin to the server runtime.');\n }\n\n // Add Sentry plugin\n // Runs only on server-side (Nitro)\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)),\n );\n }\n });\n}\n\n/**\n * Normalizes the beginning of a path from e.g. ../../../ to ./\n */\nfunction normalizePath(path: string): string {\n return path.replace(/^(\\.\\.\\/)+/, './');\n}\n\n/**\n * Generates source maps upload options for the Sentry Vite and Rollup plugin.\n *\n * Only exported for Testing purposes.\n */\n// todo(v11): This \"eslint-disable\" can be removed again once we remove deprecated options.\n// eslint-disable-next-line complexity\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n shouldDeleteFilesFallback?: { client: boolean; server: boolean },\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n // eslint-disable-next-line deprecation/deprecation\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n const shouldDeleteFilesAfterUpload = shouldDeleteFilesFallback?.client || shouldDeleteFilesFallback?.server;\n const fallbackFilesToDelete = [\n ...(shouldDeleteFilesFallback?.client ? ['.*/**/public/**/*.map'] : []),\n ...(shouldDeleteFilesFallback?.server\n ? ['.*/**/server/**/*.map', '.*/**/output/**/*.map', '.*/**/function/**/*.map']\n : []),\n ];\n\n // Check for filesToDeleteAfterUpload in new location first, then deprecated location\n const sourcemapsOptions = moduleOptions.sourcemaps || {};\n // eslint-disable-next-line deprecation/deprecation\n const deprecatedSourcemapsOptions = sourceMapsUploadOptions.sourcemaps || {};\n\n const filesToDeleteAfterUpload =\n sourcemapsOptions.filesToDeleteAfterUpload ??\n // eslint-disable-next-line deprecation/deprecation\n deprecatedSourcemapsOptions.filesToDeleteAfterUpload;\n\n if (typeof filesToDeleteAfterUpload === 'undefined' && shouldDeleteFilesAfterUpload && moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Setting \\`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete\n // Logging it as strings in the array\n .map(path => `\"${path}\"`)\n .join(', ')}]\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n\n return {\n // eslint-disable-next-line deprecation/deprecation\n org: moduleOptions.org ?? sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n // eslint-disable-next-line deprecation/deprecation\n project: moduleOptions.project ?? sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n // eslint-disable-next-line deprecation/deprecation\n authToken: moduleOptions.authToken ?? sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n // eslint-disable-next-line deprecation/deprecation\n telemetry: moduleOptions.telemetry ?? sourceMapsUploadOptions.telemetry ?? true,\n // eslint-disable-next-line deprecation/deprecation\n url: moduleOptions.sentryUrl ?? sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n headers: moduleOptions.headers,\n debug: moduleOptions.debug ?? false,\n // eslint-disable-next-line deprecation/deprecation\n silent: moduleOptions.silent ?? sourceMapsUploadOptions.silent ?? false,\n // eslint-disable-next-line deprecation/deprecation\n errorHandler: moduleOptions.errorHandler ?? sourceMapsUploadOptions.errorHandler,\n bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations, // todo: test if this can be overridden by the user\n release: {\n // eslint-disable-next-line deprecation/deprecation\n name: moduleOptions.release?.name ?? sourceMapsUploadOptions.release?.name,\n // Support all release options from BuildTimeOptionsBase\n ...moduleOptions.release,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\n disable: moduleOptions.sourcemaps?.disable,\n // The server/client files are in different places depending on the nitro preset (e.g. '.output/server' or '.netlify/functions-internal/server')\n // We cannot determine automatically how the build folder looks like (depends on the preset), so we have to accept that source maps are uploaded multiple times (with the vitePlugin for Nuxt and the rollupPlugin for Nitro).\n // If we could know where the server/client assets are located, we could do something like this (based on the Nitro preset): isNitro ? ['./.output/server/**/*'] : ['./.output/public/**/*'],\n // eslint-disable-next-line deprecation/deprecation\n assets: sourcemapsOptions.assets ?? deprecatedSourcemapsOptions.assets ?? undefined,\n // eslint-disable-next-line deprecation/deprecation\n ignore: sourcemapsOptions.ignore ?? deprecatedSourcemapsOptions.ignore ?? undefined,\n filesToDeleteAfterUpload: filesToDeleteAfterUpload\n ? filesToDeleteAfterUpload\n : shouldDeleteFilesFallback?.server || shouldDeleteFilesFallback?.client\n ? fallbackFilesToDelete\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* There are multiple ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993 and https://github.com/getsentry/sentry-javascript/pull/15859)\n 1. User explicitly disabled source maps\n - keep this setting (emit a warning that errors won't be unminified in Sentry)\n - We will not upload anything\n 2. users enabled source map generation (true, hidden, inline).\n - keep this setting (don't do anything - like deletion - besides uploading)\n 3. users did not set source maps generation\n - we enable 'hidden' source maps generation\n - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n\n Users only have to explicitly enable client source maps. Sentry only overwrites the base Nuxt source map settings as they propagate.\n */\n\n/** only exported for tests */\nexport function extractNuxtSourceMapSetting(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting; client?: SourceMapSetting } } },\n runtime: 'client' | 'server' | undefined,\n): SourceMapSetting | undefined {\n if (!runtime) {\n return undefined;\n } else {\n return typeof nuxt.options?.sourcemap === 'boolean' || typeof nuxt.options?.sourcemap === 'string'\n ? nuxt.options.sourcemap\n : nuxt.options?.sourcemap?.[runtime];\n }\n}\n\n/** only exported for testing */\nexport function changeNuxtSourceMapSettings(\n nuxt: Nuxt,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): { client: UserSourceMapSetting; server: UserSourceMapSetting } {\n nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: undefined, client: undefined };\n\n let previousUserSourceMapSetting: { client: UserSourceMapSetting; server: UserSourceMapSetting } = {\n client: undefined,\n server: undefined,\n };\n\n const nuxtSourceMap = nuxt.options.sourcemap;\n const isDebug = sentryModuleOptions.debug;\n\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap', isDebug);\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap', (nuxtSourceMap as true).toString());\n previousUserSourceMapSetting = { client: 'enabled', server: 'enabled' };\n break;\n case undefined:\n nuxt.options.sourcemap = { server: 'hidden', client: 'hidden' };\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client', isDebug);\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server', isDebug);\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** Logs warnings about potentially conflicting source map settings.\n * Configures `sourcemapExcludeSources` in Nitro to make source maps usable in Sentry.\n *\n * only exported for testing\n */\nexport function validateNitroSourceMapSettings(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting } } },\n nitroConfig: NitroConfig,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): void {\n const isDebug = sentryModuleOptions.debug;\n const nuxtSourceMap = extractNuxtSourceMapSetting(nuxt, 'server');\n\n // NITRO CONFIG ---\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: 'nitro.sourceMap',\n otherSettingValue: nitroConfig.sourceMap,\n });\n\n // ROLLUP CONFIG ---\n\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n const nitroRollupSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n // We don't override nitro.rollupConfig.output.sourcemap (undefined by default, but overrides all other server-side source map settings)\n if (typeof nitroRollupSourceMap !== 'undefined' && ['hidden', 'inline', true, false].includes(nitroRollupSourceMap)) {\n const settingKey = 'nitro.rollupConfig.output.sourcemap';\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: settingKey,\n otherSettingValue: nitroRollupSourceMap,\n });\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Set `sourcemapExcludeSources: false` in the Nuxt config (`nitro.rollupConfig.output`). Source maps will now include the actual code to be able to un-minify code snippets in Sentry.',\n );\n }\n}\n\nfunction validateDifferentSourceMapSettings({\n nuxtSettingKey,\n nuxtSettingValue,\n otherSettingKey,\n otherSettingValue,\n}: {\n nuxtSettingKey: string;\n nuxtSettingValue?: SourceMapSetting;\n otherSettingKey: string;\n otherSettingValue?: SourceMapSetting;\n}): void {\n if (nuxtSettingValue !== otherSettingValue) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation settings are conflicting. Sentry uses \\`${nuxtSettingKey}: ${nuxtSettingValue}\\`. However, a conflicting setting was discovered (\\`${otherSettingKey}: ${otherSettingValue}\\`). This setting was probably explicitly set in your configuration. Sentry won't override this setting but it may affect source maps generation and upload. Without source maps, code snippets on the Sentry Issues page will remain minified.`,\n );\n }\n}\n\nfunction logKeepEnabledSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] \\`${settingKey}\\` is enabled with \\`${settingValue}\\`. This will correctly un-minify the code snippet on the Sentry Issue Details page.`,\n );\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string, isDebug: boolean | undefined): void {\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your Vite configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(`[Sentry] Source map generation (\\`${settingKey}\\`) is disabled in your Vite configuration.`);\n }\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;;AAMA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAA2B,IAAI,EAAc;AAC1F;;AAEA,EAAE,MAAM,OAAA,GAAU,aAAa,CAAC,KAAK;;AAErC;AACA,EAAE,MAAM,0BAA0B,aAAa,CAAC,uBAAA,IAA2B,EAAE;;AAE7E,EAAE,MAAM,iBAAA;AACR,IAAI,aAAa,CAAC,UAAU,EAAE,YAAY;AAC1C,QAAQ;AACR,QAAQ,aAAa,CAAC,UAAU,EAAE,YAAY;AAC9C,UAAU;AACV;AACA,WAAW,uBAAuB,CAAC,OAAA,IAAW,IAAI,CAAC;;AAEnD;AACA,EAAE,IAAI,yBAAA,GAA4B,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAA,EAAM;;AAEhE,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM;AAClC,IAAI,IAAI,iBAAA,IAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAChD;AACA;AACA;AACA;;AAEA;AACA,MAAM,MAAM,4BAA4B,2BAA2B,CAAC,IAAI,EAAE,aAAa,CAAC;;AAExF,MAAM,4BAA4B;AAClC,QAAQ,MAAM,EAAE,yBAAyB,CAAC,MAAA,KAAW,OAAO;AAC5D,QAAQ,MAAM,EAAE,yBAAyB,CAAC,MAAA,KAAW,OAAO;AAC5D,OAAO;;AAEP,MAAM;AACN,QAAQ,OAAA;AACR,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,wBAAA;AACnC;AACA,QAAQ,CAAC,uBAAuB,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CAAA,wCAAA,CAAA;AACA,KAAA;AACA,GAAA,MAAA;AACA;AACA,IAAA,OAAA,CAAA,IAAA,CAAA,CAAA,kCAAA,EAAA,UAAA,CAAA,2CAAA,CAAA,CAAA;AACA;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 { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin';\nimport { type SentryVitePluginOptions, sentryVitePlugin } 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) {\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 (\n isDebug &&\n !moduleOptions.sourcemaps?.filesToDeleteAfterUpload &&\n // eslint-disable-next-line deprecation/deprecation\n !sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload &&\n (shouldDeleteFilesFallback.client || shouldDeleteFilesFallback.server)\n ) {\n // eslint-disable-next-line no-console\n console.log(\n \"[Sentry] As Sentry enabled `'hidden'` source maps, source maps will be automatically deleted after uploading them to Sentry.\",\n );\n }\n }\n });\n\n nuxt.hook('vite:extendConfig', async (viteConfig, env) => {\n if (sourceMapsEnabled && viteConfig.mode !== 'development') {\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) {\n if (!nitroConfig.rollupConfig) {\n nitroConfig.rollupConfig = {};\n }\n\n if (nitroConfig.rollupConfig.plugins === null || nitroConfig.rollupConfig.plugins === undefined) {\n nitroConfig.rollupConfig.plugins = [];\n } else if (!Array.isArray(nitroConfig.rollupConfig.plugins)) {\n // `rollupConfig.plugins` can be a single plugin, so we want to put it into an array so that we can push our own plugin\n nitroConfig.rollupConfig.plugins = [nitroConfig.rollupConfig.plugins];\n }\n\n validateNitroSourceMapSettings(nuxt, nitroConfig, moduleOptions);\n\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log('[Sentry] Adding Sentry Rollup plugin to the server runtime.');\n }\n\n // Add Sentry plugin\n // Runs only on server-side (Nitro)\n nitroConfig.rollupConfig.plugins.push(\n sentryRollupPlugin(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)),\n );\n }\n });\n}\n\n/**\n * Normalizes the beginning of a path from e.g. ../../../ to ./\n */\nfunction normalizePath(path: string): string {\n return path.replace(/^(\\.\\.\\/)+/, './');\n}\n\n/**\n * Generates source maps upload options for the Sentry Vite and Rollup plugin.\n *\n * Only exported for Testing purposes.\n */\n// todo(v11): This \"eslint-disable\" can be removed again once we remove deprecated options.\n// eslint-disable-next-line complexity\nexport function getPluginOptions(\n moduleOptions: SentryNuxtModuleOptions,\n shouldDeleteFilesFallback?: { client: boolean; server: boolean },\n): SentryVitePluginOptions | SentryRollupPluginOptions {\n // eslint-disable-next-line deprecation/deprecation\n const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};\n\n const shouldDeleteFilesAfterUpload = shouldDeleteFilesFallback?.client || shouldDeleteFilesFallback?.server;\n const fallbackFilesToDelete = [\n ...(shouldDeleteFilesFallback?.client ? ['.*/**/public/**/*.map'] : []),\n ...(shouldDeleteFilesFallback?.server\n ? ['.*/**/server/**/*.map', '.*/**/output/**/*.map', '.*/**/function/**/*.map']\n : []),\n ];\n\n // Check for filesToDeleteAfterUpload in new location first, then deprecated location\n const sourcemapsOptions = moduleOptions.sourcemaps || {};\n // eslint-disable-next-line deprecation/deprecation\n const deprecatedSourcemapsOptions = sourceMapsUploadOptions.sourcemaps || {};\n\n const filesToDeleteAfterUpload =\n sourcemapsOptions.filesToDeleteAfterUpload ??\n // eslint-disable-next-line deprecation/deprecation\n deprecatedSourcemapsOptions.filesToDeleteAfterUpload;\n\n if (typeof filesToDeleteAfterUpload === 'undefined' && shouldDeleteFilesAfterUpload && moduleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Setting \\`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete\n // Logging it as strings in the array\n .map(path => `\"${path}\"`)\n .join(', ')}]\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n\n return {\n // eslint-disable-next-line deprecation/deprecation\n org: moduleOptions.org ?? sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,\n // eslint-disable-next-line deprecation/deprecation\n project: moduleOptions.project ?? sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,\n // eslint-disable-next-line deprecation/deprecation\n authToken: moduleOptions.authToken ?? sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN,\n // eslint-disable-next-line deprecation/deprecation\n telemetry: moduleOptions.telemetry ?? sourceMapsUploadOptions.telemetry ?? true,\n // eslint-disable-next-line deprecation/deprecation\n url: moduleOptions.sentryUrl ?? sourceMapsUploadOptions.url ?? process.env.SENTRY_URL,\n headers: moduleOptions.headers,\n debug: moduleOptions.debug ?? false,\n // eslint-disable-next-line deprecation/deprecation\n silent: moduleOptions.silent ?? sourceMapsUploadOptions.silent ?? false,\n // eslint-disable-next-line deprecation/deprecation\n errorHandler: moduleOptions.errorHandler ?? sourceMapsUploadOptions.errorHandler,\n bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations, // todo: test if this can be overridden by the user\n release: {\n // eslint-disable-next-line deprecation/deprecation\n name: moduleOptions.release?.name ?? sourceMapsUploadOptions.release?.name,\n // Support all release options from BuildTimeOptionsBase\n ...moduleOptions.release,\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release,\n },\n _metaOptions: {\n telemetry: {\n metaFramework: 'nuxt',\n },\n },\n ...moduleOptions?.unstable_sentryBundlerPluginOptions,\n\n sourcemaps: {\n disable: moduleOptions.sourcemaps?.disable,\n // The server/client files are in different places depending on the nitro preset (e.g. '.output/server' or '.netlify/functions-internal/server')\n // We cannot determine automatically how the build folder looks like (depends on the preset), so we have to accept that source maps are uploaded multiple times (with the vitePlugin for Nuxt and the rollupPlugin for Nitro).\n // If we could know where the server/client assets are located, we could do something like this (based on the Nitro preset): isNitro ? ['./.output/server/**/*'] : ['./.output/public/**/*'],\n // eslint-disable-next-line deprecation/deprecation\n assets: sourcemapsOptions.assets ?? deprecatedSourcemapsOptions.assets ?? undefined,\n // eslint-disable-next-line deprecation/deprecation\n ignore: sourcemapsOptions.ignore ?? deprecatedSourcemapsOptions.ignore ?? undefined,\n filesToDeleteAfterUpload: filesToDeleteAfterUpload\n ? filesToDeleteAfterUpload\n : shouldDeleteFilesFallback?.server || shouldDeleteFilesFallback?.client\n ? fallbackFilesToDelete\n : undefined,\n rewriteSources: (source: string) => normalizePath(source),\n ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps,\n },\n };\n}\n\n/* There are multiple ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993 and https://github.com/getsentry/sentry-javascript/pull/15859)\n 1. User explicitly disabled source maps\n - keep this setting (emit a warning that errors won't be unminified in Sentry)\n - We will not upload anything\n 2. users enabled source map generation (true, hidden, inline).\n - keep this setting (don't do anything - like deletion - besides uploading)\n 3. users did not set source maps generation\n - we enable 'hidden' source maps generation\n - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n\n Users only have to explicitly enable client source maps. Sentry only overwrites the base Nuxt source map settings as they propagate.\n */\n\n/** only exported for tests */\nexport function extractNuxtSourceMapSetting(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting; client?: SourceMapSetting } } },\n runtime: 'client' | 'server' | undefined,\n): SourceMapSetting | undefined {\n if (!runtime) {\n return undefined;\n } else {\n return typeof nuxt.options?.sourcemap === 'boolean' || typeof nuxt.options?.sourcemap === 'string'\n ? nuxt.options.sourcemap\n : nuxt.options?.sourcemap?.[runtime];\n }\n}\n\n/** only exported for testing */\nexport function changeNuxtSourceMapSettings(\n nuxt: Nuxt,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): { client: UserSourceMapSetting; server: UserSourceMapSetting } {\n nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: undefined, client: undefined };\n\n let previousUserSourceMapSetting: { client: UserSourceMapSetting; server: UserSourceMapSetting } = {\n client: undefined,\n server: undefined,\n };\n\n const nuxtSourceMap = nuxt.options.sourcemap;\n const isDebug = sentryModuleOptions.debug;\n\n if (typeof nuxtSourceMap === 'string' || typeof nuxtSourceMap === 'boolean' || typeof nuxtSourceMap === 'undefined') {\n switch (nuxtSourceMap) {\n case false:\n warnExplicitlyDisabledSourceMap('sourcemap', isDebug);\n previousUserSourceMapSetting = { client: 'disabled', server: 'disabled' };\n break;\n\n case 'hidden':\n case true:\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap', (nuxtSourceMap as true).toString());\n previousUserSourceMapSetting = { client: 'enabled', server: 'enabled' };\n break;\n case undefined:\n nuxt.options.sourcemap = { server: 'hidden', client: 'hidden' };\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting = { client: 'unset', server: 'unset' };\n break;\n }\n } else {\n if (nuxtSourceMap.client === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.client', isDebug);\n previousUserSourceMapSetting.client = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.client)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.client', nuxtSourceMap.client.toString());\n previousUserSourceMapSetting.client = 'enabled';\n } else {\n nuxt.options.sourcemap.client = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.client', 'hidden');\n previousUserSourceMapSetting.client = 'unset';\n }\n\n if (nuxtSourceMap.server === false) {\n warnExplicitlyDisabledSourceMap('sourcemap.server', isDebug);\n previousUserSourceMapSetting.server = 'disabled';\n } else if (['hidden', true].includes(nuxtSourceMap.server)) {\n logKeepEnabledSourceMapSetting(sentryModuleOptions, 'sourcemap.server', nuxtSourceMap.server.toString());\n previousUserSourceMapSetting.server = 'enabled';\n } else {\n nuxt.options.sourcemap.server = 'hidden';\n isDebug && logSentryEnablesSourceMap('sourcemap.server', 'hidden');\n previousUserSourceMapSetting.server = 'unset';\n }\n }\n\n return previousUserSourceMapSetting;\n}\n\n/** Logs warnings about potentially conflicting source map settings.\n * Configures `sourcemapExcludeSources` in Nitro to make source maps usable in Sentry.\n *\n * only exported for testing\n */\nexport function validateNitroSourceMapSettings(\n nuxt: { options: { sourcemap?: SourceMapSetting | { server?: SourceMapSetting } } },\n nitroConfig: NitroConfig,\n sentryModuleOptions: SentryNuxtModuleOptions,\n): void {\n const isDebug = sentryModuleOptions.debug;\n const nuxtSourceMap = extractNuxtSourceMapSetting(nuxt, 'server');\n\n // NITRO CONFIG ---\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: 'nitro.sourceMap',\n otherSettingValue: nitroConfig.sourceMap,\n });\n\n // ROLLUP CONFIG ---\n\n nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};\n nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: undefined };\n const nitroRollupSourceMap = nitroConfig.rollupConfig.output.sourcemap;\n\n // We don't override nitro.rollupConfig.output.sourcemap (undefined by default, but overrides all other server-side source map settings)\n if (typeof nitroRollupSourceMap !== 'undefined' && ['hidden', 'inline', true, false].includes(nitroRollupSourceMap)) {\n const settingKey = 'nitro.rollupConfig.output.sourcemap';\n\n validateDifferentSourceMapSettings({\n nuxtSettingKey: 'sourcemap.server',\n nuxtSettingValue: nuxtSourceMap,\n otherSettingKey: settingKey,\n otherSettingValue: nitroRollupSourceMap,\n });\n }\n\n nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Set `sourcemapExcludeSources: false` in the Nuxt config (`nitro.rollupConfig.output`). Source maps will now include the actual code to be able to un-minify code snippets in Sentry.',\n );\n }\n}\n\nfunction validateDifferentSourceMapSettings({\n nuxtSettingKey,\n nuxtSettingValue,\n otherSettingKey,\n otherSettingValue,\n}: {\n nuxtSettingKey: string;\n nuxtSettingValue?: SourceMapSetting;\n otherSettingKey: string;\n otherSettingValue?: SourceMapSetting;\n}): void {\n if (nuxtSettingValue !== otherSettingValue) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation settings are conflicting. Sentry uses \\`${nuxtSettingKey}: ${nuxtSettingValue}\\`. However, a conflicting setting was discovered (\\`${otherSettingKey}: ${otherSettingValue}\\`). This setting was probably explicitly set in your configuration. Sentry won't override this setting but it may affect source maps generation and upload. Without source maps, code snippets on the Sentry Issues page will remain minified.`,\n );\n }\n}\n\nfunction logKeepEnabledSourceMapSetting(\n sentryNuxtModuleOptions: SentryNuxtModuleOptions,\n settingKey: string,\n settingValue: string,\n): void {\n if (sentryNuxtModuleOptions.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] \\`${settingKey}\\` is enabled with \\`${settingValue}\\`. This will correctly un-minify the code snippet on the Sentry Issue Details page.`,\n );\n }\n}\n\nfunction warnExplicitlyDisabledSourceMap(settingKey: string, isDebug: boolean | undefined): void {\n if (isDebug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your Vite configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(`[Sentry] Source map generation (\\`${settingKey}\\`) is disabled in your Vite configuration.`);\n }\n}\n\nfunction logSentryEnablesSourceMap(settingKey: string, settingValue: string): void {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Enabled source map generation in the build options with \\`${settingKey}: ${settingValue}\\`.`);\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;;AAMA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAA2B,IAAI,EAAc;AAC1F;;AAEA,EAAE,MAAM,OAAA,GAAU,aAAa,CAAC,KAAK;;AAErC;AACA,EAAE,MAAM,0BAA0B,aAAa,CAAC,uBAAA,IAA2B,EAAE;;AAE7E,EAAE,MAAM,iBAAA;AACR,IAAI,aAAa,CAAC,UAAU,EAAE,YAAY;AAC1C,QAAQ;AACR,QAAQ,aAAa,CAAC,UAAU,EAAE,YAAY;AAC9C,UAAU;AACV;AACA,WAAW,uBAAuB,CAAC,OAAA,IAAW,IAAI,CAAC;;AAEnD;AACA,EAAE,IAAI,yBAAA,GAA4B,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAA,EAAM;;AAEhE,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM;AAClC,IAAI,IAAI,iBAAA,IAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAChD;AACA;AACA;AACA;;AAEA;AACA,MAAM,MAAM,4BAA4B,2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OAAA,CAAA;AACA,KAAA;AACA,EAAA;AACA;;AAEA,SAAA,8BAAA;AACA,EAAA,uBAAA;AACA,EAAA,UAAA;AACA,EAAA,YAAA;AACA,EAAA;AACA,EAAA,IAAA,uBAAA,CAAA,KAAA,EAAA;AACA;AACA,IAAA,OAAA,CAAA,GAAA;AACA,MAAA,CAAA,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 +1 @@
1
- {"version":3,"file":"storageConfig.js","sources":["../../../src/vite/storageConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport type { Nuxt } from 'nuxt/schema';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Prepares the storage config export to be used in the runtime storage instrumentation.\n */\nexport function addStorageInstrumentation(nuxt: Nuxt): void {\n const moduleDirResolver = createResolver(import.meta.url);\n const userStorageMounts = Object.keys(nuxt.options.nitro.storage || {});\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/storage-config.mjs',\n getContents: () => {\n return `export const userStorageMounts = ${JSON.stringify(userStorageMounts)};`;\n },\n });\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage.server'));\n}\n"],"names":[],"mappings":";;;AAIA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,IAAI,EAAc;AAC5D,EAAE,MAAM,iBAAA,GAAoB,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3D,EAAE,MAAM,iBAAA,GAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;;AAEzE;AACA,EAAE,iBAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,4BAA4B;AAC1C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,iCAAiC,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACrF,KAAK;AACL,GAAG,CAAC;;AAEJ,EAAE,eAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAChF;;;;"}
1
+ {"version":3,"file":"storageConfig.js","sources":["../../../src/vite/storageConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport type { Nuxt } from 'nuxt/schema';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Prepares the storage config export to be used in the runtime storage instrumentation.\n */\nexport function addStorageInstrumentation(nuxt: Nuxt): void {\n const moduleDirResolver = createResolver(import.meta.url);\n const userStorageMounts = Object.keys(nuxt.options.nitro.storage || {});\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/storage-config.mjs',\n getContents: () => {\n return `export const userStorageMounts = ${JSON.stringify(userStorageMounts)};`;\n },\n });\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage.server'));\n}\n"],"names":[],"mappings":";;;AAIA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,IAAI,EAAc;AAC5D,EAAE,MAAM,iBAAA,GAAoB,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3D,EAAE,MAAM,iBAAA,GAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;;AAEzE;AACA,EAAE,iBAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,4BAA4B;AAC1C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,iCAAiC,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACrF,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAE,eAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAChF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nuxt } from 'nuxt/schema';\nimport * as path from 'path';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const cwd = process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch?.[1]\n ?.split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n const reexport =\n reexportMatch?.[1]\n ?.split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n \"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt): void {\n if (!nuxt.options.dev) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAAuB,IAAI,EAA6B;AACnG,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACzE,EAAE,MAAM,aAAa,GAAa,EAAE;;A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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,0BAAA,CAAA,IAAA,EAAA;AACA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,GAAA,EAAA;AACA,IAAA;AACA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,GAAA,EAAA;AACA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,GAAA,6CAAA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nuxt } from 'nuxt/schema';\nimport * as path from 'path';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const cwd = process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch?.[1]\n ?.split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n const reexport =\n reexportMatch?.[1]\n ?.split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) || [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n \"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt): void {\n if (!nuxt.options.dev) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAAuB,IAAI,EAA6B;AACnG,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACzE,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,IAAA,KAAS,QAA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QAAA,EAAA;AACA,OAAA;AACA,KAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,0BAAA,CAAA,IAAA,EAAA;AACA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,GAAA,EAAA;AACA,IAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,GAAA,EAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,GAAA,6CAAA;AACA,EAAA;AACA;;;;"}
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "10.24.0",
7
+ "version": "10.25.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "10.24.0",
3
+ "version": "10.25.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,13 +49,13 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@nuxt/kit": "^3.13.2",
52
- "@sentry/browser": "10.24.0",
53
- "@sentry/cloudflare": "10.24.0",
54
- "@sentry/core": "10.24.0",
55
- "@sentry/node": "10.24.0",
52
+ "@sentry/browser": "10.25.0",
53
+ "@sentry/cloudflare": "10.25.0",
54
+ "@sentry/core": "10.25.0",
55
+ "@sentry/node": "10.25.0",
56
56
  "@sentry/rollup-plugin": "^4.3.0",
57
57
  "@sentry/vite-plugin": "^4.3.0",
58
- "@sentry/vue": "10.24.0"
58
+ "@sentry/vue": "10.25.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@nuxt/module-builder": "^0.8.4",