(
moduleOptions: SentryNuxtModuleOptions,
shouldDeleteFilesFallback?: { client: boolean; server: boolean },
)
| 136 | // todo(v11): This "eslint-disable" can be removed again once we remove deprecated options. |
| 137 | // eslint-disable-next-line complexity |
| 138 | export function getPluginOptions( |
| 139 | moduleOptions: SentryNuxtModuleOptions, |
| 140 | shouldDeleteFilesFallback?: { client: boolean; server: boolean }, |
| 141 | ): SentryVitePluginOptions | SentryRollupPluginOptions { |
| 142 | // eslint-disable-next-line typescript/no-deprecated |
| 143 | const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {}; |
| 144 | |
| 145 | const shouldDeleteFilesAfterUpload = shouldDeleteFilesFallback?.client || shouldDeleteFilesFallback?.server; |
| 146 | const fallbackFilesToDelete = [ |
| 147 | ...(shouldDeleteFilesFallback?.client ? ['.*/**/public/**/*.map'] : []), |
| 148 | ...(shouldDeleteFilesFallback?.server |
| 149 | ? ['.*/**/server/**/*.map', '.*/**/output/**/*.map', '.*/**/function/**/*.map'] |
| 150 | : []), |
| 151 | ]; |
| 152 | |
| 153 | // Check for filesToDeleteAfterUpload in new location first, then deprecated location |
| 154 | const sourcemapsOptions = moduleOptions.sourcemaps || {}; |
| 155 | // eslint-disable-next-line typescript/no-deprecated |
| 156 | const deprecatedSourcemapsOptions = sourceMapsUploadOptions.sourcemaps || {}; |
| 157 | |
| 158 | const filesToDeleteAfterUpload = |
| 159 | sourcemapsOptions.filesToDeleteAfterUpload ?? |
| 160 | // eslint-disable-next-line typescript/no-deprecated |
| 161 | deprecatedSourcemapsOptions.filesToDeleteAfterUpload; |
| 162 | |
| 163 | if (typeof filesToDeleteAfterUpload === 'undefined' && shouldDeleteFilesAfterUpload && moduleOptions.debug) { |
| 164 | // eslint-disable-next-line no-console |
| 165 | console.log( |
| 166 | `[Sentry] Setting \`sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete |
| 167 | // Logging it as strings in the array |
| 168 | .map(path => `"${path}"`) |
| 169 | .join(', ')}]\` to delete generated source maps after they were uploaded to Sentry.`, |
| 170 | ); |
| 171 | } |
| 172 | |
| 173 | return { |
| 174 | applicationKey: moduleOptions.applicationKey, |
| 175 | // eslint-disable-next-line typescript/no-deprecated |
| 176 | org: moduleOptions.org ?? sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG, |
| 177 | // eslint-disable-next-line typescript/no-deprecated |
| 178 | project: moduleOptions.project ?? sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT, |
| 179 | // eslint-disable-next-line typescript/no-deprecated |
| 180 | authToken: moduleOptions.authToken ?? sourceMapsUploadOptions.authToken ?? process.env.SENTRY_AUTH_TOKEN, |
| 181 | // eslint-disable-next-line typescript/no-deprecated |
| 182 | telemetry: moduleOptions.telemetry ?? sourceMapsUploadOptions.telemetry ?? true, |
| 183 | // eslint-disable-next-line typescript/no-deprecated |
| 184 | url: moduleOptions.sentryUrl ?? sourceMapsUploadOptions.url ?? process.env.SENTRY_URL, |
| 185 | headers: moduleOptions.headers, |
| 186 | debug: moduleOptions.debug ?? false, |
| 187 | // eslint-disable-next-line typescript/no-deprecated |
| 188 | silent: moduleOptions.silent ?? sourceMapsUploadOptions.silent ?? false, |
| 189 | // eslint-disable-next-line typescript/no-deprecated |
| 190 | errorHandler: moduleOptions.errorHandler ?? sourceMapsUploadOptions.errorHandler, |
| 191 | bundleSizeOptimizations: moduleOptions.bundleSizeOptimizations, // todo: test if this can be overridden by the user |
| 192 | release: { |
| 193 | // eslint-disable-next-line typescript/no-deprecated |
| 194 | name: moduleOptions.release?.name ?? sourceMapsUploadOptions.release?.name, |
| 195 | // Support all release options from BuildTimeOptionsBase |
no test coverage detected