( options?: SentryNitroOptions, sentryEnabledSourcemaps?: boolean, outputDir?: string, )
| 82 | */ |
| 83 | // oxlint-disable-next-line complexity |
| 84 | export function getPluginOptions( |
| 85 | options?: SentryNitroOptions, |
| 86 | sentryEnabledSourcemaps?: boolean, |
| 87 | outputDir?: string, |
| 88 | ): BundlerPluginOptions { |
| 89 | const defaultFilesToDelete = |
| 90 | sentryEnabledSourcemaps && outputDir ? [`${removeTrailingSlash(outputDir)}/**/*.map`] : undefined; |
| 91 | |
| 92 | if (options?.debug && defaultFilesToDelete && options?.sourcemaps?.filesToDeleteAfterUpload === undefined) { |
| 93 | // eslint-disable-next-line no-console |
| 94 | console.log( |
| 95 | `[@sentry/nitro] Setting \`sourcemaps.filesToDeleteAfterUpload: ["${defaultFilesToDelete[0]}"]\` to delete generated source maps after they were uploaded to Sentry.`, |
| 96 | ); |
| 97 | } |
| 98 | |
| 99 | return { |
| 100 | org: options?.org ?? process.env.SENTRY_ORG, |
| 101 | project: options?.project ?? process.env.SENTRY_PROJECT, |
| 102 | authToken: options?.authToken ?? process.env.SENTRY_AUTH_TOKEN, |
| 103 | url: options?.sentryUrl ?? process.env.SENTRY_URL, |
| 104 | headers: options?.headers, |
| 105 | telemetry: options?.telemetry ?? true, |
| 106 | debug: options?.debug ?? false, |
| 107 | silent: options?.silent ?? false, |
| 108 | errorHandler: options?.errorHandler, |
| 109 | sourcemaps: { |
| 110 | disable: options?.sourcemaps?.disable, |
| 111 | assets: options?.sourcemaps?.assets, |
| 112 | ignore: options?.sourcemaps?.ignore, |
| 113 | filesToDeleteAfterUpload: options?.sourcemaps?.filesToDeleteAfterUpload ?? defaultFilesToDelete, |
| 114 | rewriteSources: options?.sourcemaps?.rewriteSources ?? ((source: string) => normalizePath(source)), |
| 115 | }, |
| 116 | release: options?.release, |
| 117 | bundleSizeOptimizations: options?.bundleSizeOptimizations, |
| 118 | _metaOptions: { |
| 119 | telemetry: { |
| 120 | metaFramework: 'nitro', |
| 121 | }, |
| 122 | }, |
| 123 | }; |
| 124 | } |
| 125 | |
| 126 | /* Source map configuration rules: |
| 127 | 1. User explicitly disabled source maps (sourcemap: false) |
no test coverage detected