* Handles the actual source map upload after the build completes.
( nitro: Nitro, options?: SentryNitroOptions, sentryEnabledSourcemaps?: boolean, )
| 35 | * Handles the actual source map upload after the build completes. |
| 36 | */ |
| 37 | async function handleSourceMapUpload( |
| 38 | nitro: Nitro, |
| 39 | options?: SentryNitroOptions, |
| 40 | sentryEnabledSourcemaps?: boolean, |
| 41 | ): Promise<void> { |
| 42 | const outputDir = nitro.options.output.serverDir; |
| 43 | const pluginOptions = getPluginOptions(options, sentryEnabledSourcemaps, outputDir); |
| 44 | |
| 45 | const sentryBuildPluginManager = createSentryBuildPluginManager(pluginOptions, { |
| 46 | buildTool: 'nitro', |
| 47 | loggerPrefix: '[@sentry/nitro]', |
| 48 | }); |
| 49 | |
| 50 | await sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal(); |
| 51 | await sentryBuildPluginManager.createRelease(); |
| 52 | |
| 53 | await sentryBuildPluginManager.injectDebugIds([outputDir]); |
| 54 | |
| 55 | if (options?.sourcemaps?.disable !== 'disable-upload') { |
| 56 | await sentryBuildPluginManager.uploadSourcemaps([outputDir], { |
| 57 | // We don't prepare the artifacts because we injected debug IDs manually before |
| 58 | prepareArtifacts: false, |
| 59 | }); |
| 60 | await sentryBuildPluginManager.deleteArtifacts(); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Normalizes the beginning of a path from e.g. ../../../ to ./ |
no test coverage detected