diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index f17461a38171..ae78bac28ff7 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -53,9 +53,9 @@ "@sentry/cloudflare": "10.30.0", "@sentry/core": "10.30.0", "@sentry/node": "10.30.0", - "@sentry/rollup-plugin": "^4.3.0", - "@sentry/vite-plugin": "^4.3.0", - "@sentry/vue": "10.30.0" + "@sentry/vue": "10.30.0", + "@sentry/rollup-plugin": "^4.6.1", + "@sentry/vite-plugin": "^4.6.1" }, "devDependencies": { "@nuxt/module-builder": "^0.8.4", diff --git a/packages/react-router/package.json b/packages/react-router/package.json index f971952daa61..cb62cc4fd1ce 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -50,11 +50,11 @@ "@opentelemetry/instrumentation": "^0.208.0", "@opentelemetry/semantic-conventions": "^1.37.0", "@sentry/browser": "10.30.0", - "@sentry/cli": "^2.58.2", + "@sentry/cli": "^2.58.4", "@sentry/core": "10.30.0", "@sentry/node": "10.30.0", "@sentry/react": "10.30.0", - "@sentry/vite-plugin": "^4.1.0", + "@sentry/vite-plugin": "^4.6.1", "glob": "11.1.0" }, "devDependencies": { diff --git a/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts b/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts index a3d1e78cb285..2ee57bdc717e 100644 --- a/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts +++ b/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts @@ -30,6 +30,8 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo ...sentryConfigWithoutDeprecatedSourceMapOption } = sentryConfig; + const unstableSentryVitePluginOptions = sentryConfig.unstable_sentryVitePluginOptions; + const { authToken, org, @@ -40,26 +42,32 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo }: Omit & // Pick 'sourcemaps' from Vite plugin options as the types allow more (e.g. Promise values for `deleteFilesAfterUpload`) Pick = { - ...sentryConfig.unstable_sentryVitePluginOptions, + ...unstableSentryVitePluginOptions, ...sentryConfigWithoutDeprecatedSourceMapOption, // spread in the config without the deprecated sourceMapsUploadOptions sourcemaps: { - ...sentryConfig.unstable_sentryVitePluginOptions?.sourcemaps, + ...unstableSentryVitePluginOptions?.sourcemaps, ...sentryConfig.sourcemaps, ...sourceMapsUploadOptions, // eslint-disable-next-line deprecation/deprecation disable: sourceMapsUploadOptions?.enabled === false ? true : sentryConfig.sourcemaps?.disable, }, release: { - ...sentryConfig.unstable_sentryVitePluginOptions?.release, + ...unstableSentryVitePluginOptions?.release, ...sentryConfig.release, }, + project: unstableSentryVitePluginOptions?.project + ? Array.isArray(unstableSentryVitePluginOptions?.project) + ? unstableSentryVitePluginOptions?.project[0] + : unstableSentryVitePluginOptions?.project + : sentryConfigWithoutDeprecatedSourceMapOption.project, }; const cliInstance = new SentryCli(null, { authToken, org, - project, ...sentryConfig.unstable_sentryVitePluginOptions, + // same handling as in bundler plugins: https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/05084f214c763a05137d863ff5a05ef38254f68d/packages/bundler-plugin-core/src/build-plugin-manager.ts#L102-L103 + project: Array.isArray(project) ? project[0] : project, }); // check if release should be created diff --git a/packages/react-router/test/vite/buildEnd/handleOnBuildEnd.test.ts b/packages/react-router/test/vite/buildEnd/handleOnBuildEnd.test.ts index 8be1d7764219..a607ff3ccfc6 100644 --- a/packages/react-router/test/vite/buildEnd/handleOnBuildEnd.test.ts +++ b/packages/react-router/test/vite/buildEnd/handleOnBuildEnd.test.ts @@ -329,4 +329,40 @@ describe('sentryOnBuildEnd', () => { expect(SentryCli).toHaveBeenCalledWith(null, expect.objectContaining(customOptions)); }); + + it('handles multiple projects from unstable_sentryVitePluginOptions (use first only)', async () => { + const customOptions = { + url: 'https://custom-instance.ejemplo.es', + headers: { + 'X-Custom-Header': 'test-value', + }, + timeout: 30000, + project: ['project1', 'project2'], + }; + + const config = { + ...defaultConfig, + viteConfig: { + ...defaultConfig.viteConfig, + sentryConfig: { + ...defaultConfig.viteConfig.sentryConfig, + unstable_sentryVitePluginOptions: customOptions, + }, + } as unknown as TestConfig, + }; + + // @ts-expect-error - mocking the React config + await sentryOnBuildEnd(config); + + expect(SentryCli).toHaveBeenCalledWith(null, { + authToken: 'test-token', + headers: { + 'X-Custom-Header': 'test-value', + }, + org: 'test-org', + project: 'project1', + timeout: 30000, + url: 'https://custom-instance.ejemplo.es', + }); + }); }); diff --git a/yarn.lock b/yarn.lock index a332772b21e9..324b3a726ba4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7069,30 +7069,11 @@ fflate "^0.4.4" mitt "^3.0.0" -"@sentry/babel-plugin-component-annotate@4.3.0": - version "4.3.0" - resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-4.3.0.tgz#c5b6cbb986952596d3ad233540a90a1fd18bad80" - integrity sha512-OuxqBprXRyhe8Pkfyz/4yHQJc5c3lm+TmYWSSx8u48g5yKewSQDOxkiLU5pAk3WnbLPy8XwU/PN+2BG0YFU9Nw== - "@sentry/babel-plugin-component-annotate@4.6.1": version "4.6.1" resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-4.6.1.tgz#94eec0293be8289daa574e18783e64d29203c236" integrity sha512-aSIk0vgBqv7PhX6/Eov+vlI4puCE0bRXzUG5HdCsHBpAfeMkI8Hva6kSOusnzKqs8bf04hU7s3Sf0XxGTj/1AA== -"@sentry/bundler-plugin-core@4.3.0": - version "4.3.0" - resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-4.3.0.tgz#cf302522a3e5b8a3bf727635d0c6a7bece981460" - integrity sha512-dmR4DJhJ4jqVWGWppuTL2blNFqOZZnt4aLkewbD1myFG3KVfUx8CrMQWEmGjkgPOtj5TO6xH9PyTJjXC6o5tnA== - dependencies: - "@babel/core" "^7.18.5" - "@sentry/babel-plugin-component-annotate" "4.3.0" - "@sentry/cli" "^2.51.0" - dotenv "^16.3.1" - find-up "^5.0.0" - glob "^9.3.2" - magic-string "0.30.8" - unplugin "1.0.1" - "@sentry/bundler-plugin-core@4.6.1", "@sentry/bundler-plugin-core@^4.6.1": version "4.6.1" resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-4.6.1.tgz#d6013e6233bf663114f581bbd3c3a380ff9311d4" @@ -7107,50 +7088,50 @@ magic-string "0.30.8" unplugin "1.0.1" -"@sentry/cli-darwin@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.58.2.tgz#61f6f836de8ac2e1992ccadc0368bc403f23c609" - integrity sha512-MArsb3zLhA2/cbd4rTm09SmTpnEuZCoZOpuZYkrpDw1qzBVJmRFA1W1hGAQ9puzBIk/ubY3EUhhzuU3zN2uD6w== - -"@sentry/cli-linux-arm64@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.58.2.tgz#3a7a9c83e31b482599ce08d93d5ba6c8a1a44c7f" - integrity sha512-ay3OeObnbbPrt45cjeUyQjsx5ain1laj1tRszWj37NkKu55NZSp4QCg1gGBZ0gBGhckI9nInEsmKtix00alw2g== - -"@sentry/cli-linux-arm@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.58.2.tgz#f9bef6802cb707d1603a02e0727fed22d834e133" - integrity sha512-HU9lTCzcHqCz/7Mt5n+cv+nFuJdc1hGD2h35Uo92GgxX3/IujNvOUfF+nMX9j6BXH6hUt73R5c0Ycq9+a3Parg== - -"@sentry/cli-linux-i686@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.58.2.tgz#a3e6cb24d314f2d948b96457731f9345dc8370f9" - integrity sha512-CN9p0nfDFsAT1tTGBbzOUGkIllwS3hygOUyTK7LIm9z+UHw5uNgNVqdM/3Vg+02ymjkjISNB3/+mqEM5osGXdA== - -"@sentry/cli-linux-x64@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.58.2.tgz#8e071e11b03524b08d369075f3203b05529ca233" - integrity sha512-oX/LLfvWaJO50oBVOn4ZvG2SDWPq0MN8SV9eg5tt2nviq+Ryltfr7Rtoo+HfV+eyOlx1/ZXhq9Wm7OT3cQuz+A== - -"@sentry/cli-win32-arm64@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.58.2.tgz#af109a165c25245458a6c58b79a91c639b1df1b0" - integrity sha512-+cl3x2HPVMpoSVGVM1IDWlAEREZrrVQj4xBb0TRKII7g3hUxRsAIcsrr7+tSkie++0FuH4go/b5fGAv51OEF3w== - -"@sentry/cli-win32-i686@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.58.2.tgz#53038b43b2c14c419fb71586f7448e7580ed4e39" - integrity sha512-omFVr0FhzJ8oTJSg1Kf+gjLgzpYklY0XPfLxZ5iiMiYUKwF5uo1RJRdkUOiEAv0IqpUKnmKcmVCLaDxsWclB7Q== - -"@sentry/cli-win32-x64@2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.58.2.tgz#b4c81a3c163344ae8b27523a0391e7f99c533f41" - integrity sha512-2NAFs9UxVbRztQbgJSP5i8TB9eJQ7xraciwj/93djrSMHSEbJ0vC47TME0iifgvhlHMs5vqETOKJtfbbpQAQFA== - -"@sentry/cli@^2.51.0", "@sentry/cli@^2.57.0", "@sentry/cli@^2.58.2": - version "2.58.2" - resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.58.2.tgz#0d6e19a1771d27aae8b2765a6f3e96062e2c7502" - integrity sha512-U4u62V4vaTWF+o40Mih8aOpQKqKUbZQt9A3LorIJwaE3tO3XFLRI70eWtW2se1Qmy0RZ74zB14nYcFNFl2t4Rw== +"@sentry/cli-darwin@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.58.4.tgz#5e3005c1f845acac243e8dcb23bef17337924768" + integrity sha512-kbTD+P4X8O+nsNwPxCywtj3q22ecyRHWff98rdcmtRrvwz8CKi/T4Jxn/fnn2i4VEchy08OWBuZAqaA5Kh2hRQ== + +"@sentry/cli-linux-arm64@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.58.4.tgz#69da57656fda863f255d92123c3a3437e470408e" + integrity sha512-0g0KwsOozkLtzN8/0+oMZoOuQ0o7W6O+hx+ydVU1bktaMGKEJLMAWxOQNjsh1TcBbNIXVOKM/I8l0ROhaAb8Ig== + +"@sentry/cli-linux-arm@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.58.4.tgz#869ddab30f0dcebc0e61cff2f3ff47dcd40f8abe" + integrity sha512-rdQ8beTwnN48hv7iV7e7ZKucPec5NJkRdrrycMJMZlzGBPi56LqnclgsHySJ6Kfq506A2MNuQnKGaf/sBC9REA== + +"@sentry/cli-linux-i686@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.58.4.tgz#e30ca6b897147b3fb7b2e8684b139183d55e21c6" + integrity sha512-NseoIQAFtkziHyjZNPTu1Gm1opeQHt7Wm1LbLrGWVIRvUOzlslO9/8i6wETUZ6TjlQxBVRgd3Q0lRBG2A8rFYA== + +"@sentry/cli-linux-x64@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.58.4.tgz#f667e1fcaf0860f15401af8e0ee72f5013d84458" + integrity sha512-d3Arz+OO/wJYTqCYlSN3Ktm+W8rynQ/IMtSZLK8nu0ryh5mJOh+9XlXY6oDXw4YlsM8qCRrNquR8iEI1Y/IH+Q== + +"@sentry/cli-win32-arm64@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.58.4.tgz#f612c5788954e2a97b6626e9e46fa9a41cb049c1" + integrity sha512-bqYrF43+jXdDBh0f8HIJU3tbvlOFtGyRjHB8AoRuMQv9TEDUfENZyCelhdjA+KwDKYl48R1Yasb4EHNzsoO83w== + +"@sentry/cli-win32-i686@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.58.4.tgz#5611c05499f1b959d23e37650d0621d299c49cfc" + integrity sha512-3triFD6jyvhVcXOmGyttf+deKZcC1tURdhnmDUIBkiDPJKGT/N5xa4qAtHJlAB/h8L9jgYih9bvJnvvFVM7yug== + +"@sentry/cli-win32-x64@2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.58.4.tgz#3290c59399579e8d484c97246cfa720171241061" + integrity sha512-cSzN4PjM1RsCZ4pxMjI0VI7yNCkxiJ5jmWncyiwHXGiXrV1eXYdQ3n1LhUYLZ91CafyprR0OhDcE+RVZ26Qb5w== + +"@sentry/cli@^2.57.0", "@sentry/cli@^2.58.2", "@sentry/cli@^2.58.4": + version "2.58.4" + resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.58.4.tgz#eb8792600cdf956cc4fe2bf51380ea1682327411" + integrity sha512-ArDrpuS8JtDYEvwGleVE+FgR+qHaOp77IgdGSacz6SZy6Lv90uX0Nu4UrHCQJz8/xwIcNxSqnN22lq0dH4IqTg== dependencies: https-proxy-agent "^5.0.0" node-fetch "^2.6.7" @@ -7158,29 +7139,29 @@ proxy-from-env "^1.1.0" which "^2.0.2" optionalDependencies: - "@sentry/cli-darwin" "2.58.2" - "@sentry/cli-linux-arm" "2.58.2" - "@sentry/cli-linux-arm64" "2.58.2" - "@sentry/cli-linux-i686" "2.58.2" - "@sentry/cli-linux-x64" "2.58.2" - "@sentry/cli-win32-arm64" "2.58.2" - "@sentry/cli-win32-i686" "2.58.2" - "@sentry/cli-win32-x64" "2.58.2" - -"@sentry/rollup-plugin@^4.3.0": - version "4.3.0" - resolved "https://registry.yarnpkg.com/@sentry/rollup-plugin/-/rollup-plugin-4.3.0.tgz#d23fe49e48fa68dafa2b0933a8efabcc964b1df9" - integrity sha512-Ebk6cTGTNohnLEvHtwDKYlMRs8Qit/ybOflIKlQziBHjd51GtxG9TPIu9NYU0fJXa428aYNluto3BfgdMp+c+Q== + "@sentry/cli-darwin" "2.58.4" + "@sentry/cli-linux-arm" "2.58.4" + "@sentry/cli-linux-arm64" "2.58.4" + "@sentry/cli-linux-i686" "2.58.4" + "@sentry/cli-linux-x64" "2.58.4" + "@sentry/cli-win32-arm64" "2.58.4" + "@sentry/cli-win32-i686" "2.58.4" + "@sentry/cli-win32-x64" "2.58.4" + +"@sentry/rollup-plugin@^4.6.1": + version "4.6.1" + resolved "https://registry.yarnpkg.com/@sentry/rollup-plugin/-/rollup-plugin-4.6.1.tgz#28dece8d6fad3044fd634724f6334f6b9b8f3ded" + integrity sha512-4G4oo05BhP7CjXdpTVFPInBgDNcuE5WKglALbCa2H9CY4ta8nHHPn2ni+d0WjhUIp6m5E1e+0NQ+0SxuFTCHVw== dependencies: - "@sentry/bundler-plugin-core" "4.3.0" + "@sentry/bundler-plugin-core" "4.6.1" unplugin "1.0.1" -"@sentry/vite-plugin@^4.1.0", "@sentry/vite-plugin@^4.3.0": - version "4.3.0" - resolved "https://registry.yarnpkg.com/@sentry/vite-plugin/-/vite-plugin-4.3.0.tgz#ced993a1f59046404aa26fb57b12078d13680ffa" - integrity sha512-MeTAHMmTOgBPMAjeW7/ONyXwgScZdaFFtNiALKcAODnVqC7eoHdSRIWeH5mkLr2Dvs7nqtBaDpKxRjUBgfm9LQ== +"@sentry/vite-plugin@^4.1.0", "@sentry/vite-plugin@^4.6.1": + version "4.6.1" + resolved "https://registry.yarnpkg.com/@sentry/vite-plugin/-/vite-plugin-4.6.1.tgz#883d8448c033b309528985e12e0d5d1af99ee1c6" + integrity sha512-Qvys1y3o8/bfL3ikrHnJS9zxdjt0z3POshdBl3967UcflrTqBmnGNkcVk53SlmtJWIfh85fgmrLvGYwZ2YiqNg== dependencies: - "@sentry/bundler-plugin-core" "4.3.0" + "@sentry/bundler-plugin-core" "4.6.1" unplugin "1.0.1" "@sentry/webpack-plugin@^4.6.1": @@ -18079,7 +18060,7 @@ glob@^8.0.0, glob@^8.0.1, glob@^8.0.3, glob@^8.1.0: minimatch "^5.0.1" once "^1.3.0" -glob@^9.2.0, glob@^9.3.2, glob@^9.3.3: +glob@^9.2.0, glob@^9.3.3: version "9.3.5" resolved "https://registry.yarnpkg.com/glob/-/glob-9.3.5.tgz#ca2ed8ca452781a3009685607fdf025a899dfe21" integrity sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==