@sentry/bundler-plugin-core 4.1.1 → 4.2.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.
package/dist/cjs/index.js CHANGED
@@ -8307,7 +8307,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
8307
8307
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8308
8308
  tracesSampleRate: 1,
8309
8309
  sampleRate: 1,
8310
- release: "4.1.1",
8310
+ release: "4.2.0",
8311
8311
  integrations: [],
8312
8312
  tracePropagationTargets: ["sentry.io/api"],
8313
8313
  stackParser: stackParser,
@@ -8752,7 +8752,7 @@ function createCliInstance(options) {
8752
8752
  silent: options.silent,
8753
8753
  url: options.url,
8754
8754
  vcsRemote: options.release.vcsRemote,
8755
- headers: _objectSpread2({}, getTraceData())
8755
+ headers: _objectSpread2(_objectSpread2({}, getTraceData()), options.headers)
8756
8756
  });
8757
8757
  }
8758
8758
 
@@ -8910,7 +8910,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
8910
8910
  });
8911
8911
 
8912
8912
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
8913
- process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.1.1");
8913
+ process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.2.0");
8914
8914
 
8915
8915
  // Not a bulletproof check but should be good enough to at least sometimes determine
8916
8916
  // if the plugin is called in dev/watch mode or for a prod build. The important part
@@ -9302,64 +9302,45 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9302
9302
  }))();
9303
9303
  },
9304
9304
  /**
9305
- * Uploads sourcemaps using the "Debug ID" method. This function takes a list of build artifact paths that will be uploaded
9305
+ * Uploads sourcemaps using the "Debug ID" method.
9306
+ *
9307
+ * By default, this prepares bundles in a temporary folder before uploading. You can opt into an
9308
+ * in-place, direct upload path by setting `prepareArtifacts` to `false`. If `prepareArtifacts` is set to
9309
+ * `false`, no preparation (e.g. adding `//# debugId=...` and writing adjusted source maps) is performed and no temp folder is used.
9310
+ *
9311
+ * @param buildArtifactPaths - The paths of the build artifacts to upload
9312
+ * @param opts - Optional flags to control temp folder usage and preparation
9306
9313
  */
9307
- uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths) {
9308
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
9309
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9310
- while (1) switch (_context18.prev = _context18.next) {
9314
+ uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths, opts) {
9315
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
9316
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
9317
+ while (1) switch (_context19.prev = _context19.next) {
9311
9318
  case 0:
9312
9319
  if (canUploadSourceMaps(options, logger, isDevMode)) {
9313
- _context18.next = 2;
9320
+ _context19.next = 2;
9314
9321
  break;
9315
9322
  }
9316
- return _context18.abrupt("return");
9323
+ return _context19.abrupt("return");
9317
9324
  case 2:
9318
- _context18.next = 4;
9325
+ _context19.next = 4;
9319
9326
  return startSpan(
9320
9327
  // This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
9321
9328
  {
9322
9329
  name: "debug-id-sourcemap-upload",
9323
9330
  scope: sentryScope,
9324
9331
  forceTransaction: true
9325
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
9326
- var folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps, tmpUploadFolder, assets, globAssets, globResult, debugIdChunkFilePaths, numUploadedFiles, _process$env2;
9327
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9328
- while (1) switch (_context17.prev = _context17.next) {
9332
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
9333
+ var _opts$prepareArtifact;
9334
+ var shouldPrepare, folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps, assets, globAssets, globResult, debugIdChunkFilePaths, tmpUploadFolder, _process$env2;
9335
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9336
+ while (1) switch (_context18.prev = _context18.next) {
9329
9337
  case 0:
9338
+ // If we're not using a temp folder, we must not prepare artifacts in-place (to avoid mutating user files)
9339
+ shouldPrepare = (_opts$prepareArtifact = opts === null || opts === void 0 ? void 0 : opts.prepareArtifacts) !== null && _opts$prepareArtifact !== void 0 ? _opts$prepareArtifact : true;
9330
9340
  // It is possible that this writeBundle hook (which calls this function) is called multiple times in one build (for example when reusing the plugin, or when using build tooling like `@vitejs/plugin-legacy`)
9331
9341
  // Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
9332
9342
  freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
9333
- _context17.prev = 1;
9334
- _context17.next = 4;
9335
- return startSpan({
9336
- name: "mkdtemp",
9337
- scope: sentryScope
9338
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
9339
- var _process$env;
9340
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
9341
- while (1) switch (_context10.prev = _context10.next) {
9342
- case 0:
9343
- _context10.t0 = (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env["SENTRY_TEST_OVERRIDE_TEMP_DIR"];
9344
- if (_context10.t0) {
9345
- _context10.next = 5;
9346
- break;
9347
- }
9348
- _context10.next = 4;
9349
- return fs__namespace.promises.mkdtemp(path__namespace.join(os__namespace.tmpdir(), "sentry-bundler-plugin-upload-"));
9350
- case 4:
9351
- _context10.t0 = _context10.sent;
9352
- case 5:
9353
- return _context10.abrupt("return", _context10.t0);
9354
- case 6:
9355
- case "end":
9356
- return _context10.stop();
9357
- }
9358
- }, _callee10);
9359
- })));
9360
- case 4:
9361
- tmpUploadFolder = _context17.sent;
9362
- folderToCleanUp = tmpUploadFolder;
9343
+ _context18.prev = 2;
9363
9344
  assets = (_options$sourcemaps = options.sourcemaps) === null || _options$sourcemaps === void 0 ? void 0 : _options$sourcemaps.assets;
9364
9345
  if (assets) {
9365
9346
  globAssets = assets;
@@ -9367,264 +9348,322 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9367
9348
  logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
9368
9349
  globAssets = buildArtifactPaths;
9369
9350
  }
9370
- _context17.next = 10;
9351
+ _context18.next = 7;
9371
9352
  return startSpan({
9372
9353
  name: "glob",
9373
9354
  scope: sentryScope
9374
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
9355
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
9375
9356
  var _options$sourcemaps2;
9376
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
9377
- while (1) switch (_context11.prev = _context11.next) {
9357
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
9358
+ while (1) switch (_context10.prev = _context10.next) {
9378
9359
  case 0:
9379
- _context11.next = 2;
9360
+ _context10.next = 2;
9380
9361
  return glob.glob(globAssets, {
9381
9362
  absolute: true,
9382
- nodir: true,
9363
+ // If we do not use a temp folder, we allow directories and files; CLI will traverse as needed when given paths.
9364
+ nodir: shouldPrepare,
9383
9365
  ignore: (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.ignore
9384
9366
  });
9385
9367
  case 2:
9386
- return _context11.abrupt("return", _context11.sent);
9368
+ return _context10.abrupt("return", _context10.sent);
9387
9369
  case 3:
9388
9370
  case "end":
9389
- return _context11.stop();
9371
+ return _context10.stop();
9390
9372
  }
9391
- }, _callee11);
9373
+ }, _callee10);
9392
9374
  })));
9393
- case 10:
9394
- globResult = _context17.sent;
9395
- debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
9375
+ case 7:
9376
+ globResult = _context18.sent;
9377
+ debugIdChunkFilePaths = shouldPrepare ? globResult.filter(function (debugIdChunkFilePath) {
9396
9378
  return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
9397
- }); // The order of the files output by glob() is not deterministic
9379
+ }) : globResult; // The order of the files output by glob() is not deterministic
9398
9380
  // Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
9399
9381
  debugIdChunkFilePaths.sort();
9400
9382
  if (!(Array.isArray(assets) && assets.length === 0)) {
9401
- _context17.next = 17;
9383
+ _context18.next = 14;
9402
9384
  break;
9403
9385
  }
9404
9386
  logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
9405
- _context17.next = 25;
9387
+ _context18.next = 31;
9406
9388
  break;
9407
- case 17:
9389
+ case 14:
9408
9390
  if (!(debugIdChunkFilePaths.length === 0)) {
9409
- _context17.next = 21;
9391
+ _context18.next = 18;
9410
9392
  break;
9411
9393
  }
9412
9394
  logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
9413
- _context17.next = 25;
9395
+ _context18.next = 31;
9414
9396
  break;
9397
+ case 18:
9398
+ if (shouldPrepare) {
9399
+ _context18.next = 24;
9400
+ break;
9401
+ }
9402
+ _context18.next = 21;
9403
+ return startSpan({
9404
+ name: "upload",
9405
+ scope: sentryScope
9406
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
9407
+ var _options$release$name;
9408
+ var cliInstance;
9409
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
9410
+ while (1) switch (_context11.prev = _context11.next) {
9411
+ case 0:
9412
+ cliInstance = createCliInstance(options);
9413
+ _context11.next = 3;
9414
+ return cliInstance.releases.uploadSourceMaps((_options$release$name = options.release.name) !== null && _options$release$name !== void 0 ? _options$release$name : "undefined", {
9415
+ include: [{
9416
+ paths: debugIdChunkFilePaths,
9417
+ rewrite: false,
9418
+ dist: options.release.dist
9419
+ }],
9420
+ live: "rejectOnError"
9421
+ });
9422
+ case 3:
9423
+ case "end":
9424
+ return _context11.stop();
9425
+ }
9426
+ }, _callee11);
9427
+ })));
9415
9428
  case 21:
9416
- _context17.next = 23;
9429
+ logger.info("Successfully uploaded source maps to Sentry");
9430
+ _context18.next = 31;
9431
+ break;
9432
+ case 24:
9433
+ _context18.next = 26;
9434
+ return startSpan({
9435
+ name: "mkdtemp",
9436
+ scope: sentryScope
9437
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
9438
+ var _process$env;
9439
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
9440
+ while (1) switch (_context12.prev = _context12.next) {
9441
+ case 0:
9442
+ _context12.t0 = (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env["SENTRY_TEST_OVERRIDE_TEMP_DIR"];
9443
+ if (_context12.t0) {
9444
+ _context12.next = 5;
9445
+ break;
9446
+ }
9447
+ _context12.next = 4;
9448
+ return fs__namespace.promises.mkdtemp(path__namespace.join(os__namespace.tmpdir(), "sentry-bundler-plugin-upload-"));
9449
+ case 4:
9450
+ _context12.t0 = _context12.sent;
9451
+ case 5:
9452
+ return _context12.abrupt("return", _context12.t0);
9453
+ case 6:
9454
+ case "end":
9455
+ return _context12.stop();
9456
+ }
9457
+ }, _callee12);
9458
+ })));
9459
+ case 26:
9460
+ tmpUploadFolder = _context18.sent;
9461
+ folderToCleanUp = tmpUploadFolder;
9462
+
9463
+ // Prepare into temp folder, then upload
9464
+ _context18.next = 30;
9417
9465
  return startSpan({
9418
9466
  name: "prepare-bundles",
9419
9467
  scope: sentryScope
9420
9468
  }, /*#__PURE__*/function () {
9421
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(prepBundlesSpan) {
9469
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(prepBundlesSpan) {
9422
9470
  var preparationTasks, workers, worker, workerIndex, files, stats, uploadSize;
9423
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
9424
- while (1) switch (_context15.prev = _context15.next) {
9471
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9472
+ while (1) switch (_context16.prev = _context16.next) {
9425
9473
  case 0:
9426
9474
  // Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
9427
9475
  // instead we do it with a maximum of 16 concurrent workers
9428
9476
  preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
9429
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
9477
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
9430
9478
  var _options$sourcemaps$r, _options$sourcemaps3, _options$sourcemaps4;
9431
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
9432
- while (1) switch (_context12.prev = _context12.next) {
9479
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9480
+ while (1) switch (_context13.prev = _context13.next) {
9433
9481
  case 0:
9434
- _context12.next = 2;
9482
+ _context13.next = 2;
9435
9483
  return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.rewriteSources) !== null && _options$sourcemaps$r !== void 0 ? _options$sourcemaps$r : defaultRewriteSourcesHook, (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.resolveSourceMap);
9436
9484
  case 2:
9437
9485
  case "end":
9438
- return _context12.stop();
9486
+ return _context13.stop();
9439
9487
  }
9440
- }, _callee12);
9488
+ }, _callee13);
9441
9489
  }));
9442
9490
  });
9443
9491
  workers = [];
9444
9492
  worker = /*#__PURE__*/function () {
9445
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
9493
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
9446
9494
  var task;
9447
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9448
- while (1) switch (_context13.prev = _context13.next) {
9495
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
9496
+ while (1) switch (_context14.prev = _context14.next) {
9449
9497
  case 0:
9450
9498
  if (!(preparationTasks.length > 0)) {
9451
- _context13.next = 7;
9499
+ _context14.next = 7;
9452
9500
  break;
9453
9501
  }
9454
9502
  task = preparationTasks.shift();
9455
9503
  if (!task) {
9456
- _context13.next = 5;
9504
+ _context14.next = 5;
9457
9505
  break;
9458
9506
  }
9459
- _context13.next = 5;
9507
+ _context14.next = 5;
9460
9508
  return task();
9461
9509
  case 5:
9462
- _context13.next = 0;
9510
+ _context14.next = 0;
9463
9511
  break;
9464
9512
  case 7:
9465
9513
  case "end":
9466
- return _context13.stop();
9514
+ return _context14.stop();
9467
9515
  }
9468
- }, _callee13);
9516
+ }, _callee14);
9469
9517
  }));
9470
9518
  return function worker() {
9471
- return _ref7.apply(this, arguments);
9519
+ return _ref8.apply(this, arguments);
9472
9520
  };
9473
9521
  }();
9474
9522
  for (workerIndex = 0; workerIndex < 16; workerIndex++) {
9475
9523
  workers.push(worker());
9476
9524
  }
9477
- _context15.next = 6;
9525
+ _context16.next = 6;
9478
9526
  return Promise.all(workers);
9479
9527
  case 6:
9480
- _context15.next = 8;
9528
+ _context16.next = 8;
9481
9529
  return fs__namespace.promises.readdir(tmpUploadFolder);
9482
9530
  case 8:
9483
- files = _context15.sent;
9531
+ files = _context16.sent;
9484
9532
  stats = files.map(function (file) {
9485
9533
  return fs__namespace.promises.stat(path__namespace.join(tmpUploadFolder, file));
9486
9534
  });
9487
- _context15.next = 12;
9535
+ _context16.next = 12;
9488
9536
  return Promise.all(stats);
9489
9537
  case 12:
9490
- uploadSize = _context15.sent.reduce(function (accumulator, _ref8) {
9491
- var size = _ref8.size;
9538
+ uploadSize = _context16.sent.reduce(function (accumulator, _ref9) {
9539
+ var size = _ref9.size;
9492
9540
  return accumulator + size;
9493
9541
  }, 0);
9494
9542
  setMeasurement("files", files.length, "none", prepBundlesSpan);
9495
9543
  setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
9496
- _context15.next = 17;
9544
+ _context16.next = 17;
9497
9545
  return startSpan({
9498
9546
  name: "upload",
9499
9547
  scope: sentryScope
9500
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
9501
- var _options$release$name;
9548
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
9549
+ var _options$release$name2;
9502
9550
  var cliInstance;
9503
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
9504
- while (1) switch (_context14.prev = _context14.next) {
9551
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
9552
+ while (1) switch (_context15.prev = _context15.next) {
9505
9553
  case 0:
9506
9554
  cliInstance = createCliInstance(options);
9507
- _context14.next = 3;
9508
- return cliInstance.releases.uploadSourceMaps((_options$release$name = options.release.name) !== null && _options$release$name !== void 0 ? _options$release$name : "undefined",
9509
- // unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
9510
- {
9555
+ _context15.next = 3;
9556
+ return cliInstance.releases.uploadSourceMaps((_options$release$name2 = options.release.name) !== null && _options$release$name2 !== void 0 ? _options$release$name2 : "undefined", {
9511
9557
  include: [{
9512
9558
  paths: [tmpUploadFolder],
9513
9559
  rewrite: false,
9514
9560
  dist: options.release.dist
9515
9561
  }],
9516
- // We want this promise to throw if the sourcemaps fail to upload so that we know about it.
9517
- // see: https://github.com/getsentry/sentry-cli/pull/2605
9518
9562
  live: "rejectOnError"
9519
9563
  });
9520
9564
  case 3:
9521
9565
  case "end":
9522
- return _context14.stop();
9566
+ return _context15.stop();
9523
9567
  }
9524
- }, _callee14);
9568
+ }, _callee15);
9525
9569
  })));
9526
9570
  case 17:
9527
- return _context15.abrupt("return", files.length);
9528
- case 18:
9529
9571
  case "end":
9530
- return _context15.stop();
9572
+ return _context16.stop();
9531
9573
  }
9532
- }, _callee15);
9574
+ }, _callee16);
9533
9575
  }));
9534
9576
  return function (_x) {
9535
- return _ref5.apply(this, arguments);
9577
+ return _ref6.apply(this, arguments);
9536
9578
  };
9537
9579
  }());
9538
- case 23:
9539
- numUploadedFiles = _context17.sent;
9540
- if (numUploadedFiles > 0) {
9541
- logger.info("Successfully uploaded source maps to Sentry");
9542
- }
9543
- case 25:
9544
- _context17.next = 31;
9580
+ case 30:
9581
+ logger.info("Successfully uploaded source maps to Sentry");
9582
+ case 31:
9583
+ _context18.next = 37;
9545
9584
  break;
9546
- case 27:
9547
- _context17.prev = 27;
9548
- _context17.t0 = _context17["catch"](1);
9585
+ case 33:
9586
+ _context18.prev = 33;
9587
+ _context18.t0 = _context18["catch"](2);
9549
9588
  sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
9550
- handleRecoverableError(_context17.t0, false);
9551
- case 31:
9552
- _context17.prev = 31;
9589
+ handleRecoverableError(_context18.t0, false);
9590
+ case 37:
9591
+ _context18.prev = 37;
9553
9592
  if (folderToCleanUp && !((_process$env2 = process.env) !== null && _process$env2 !== void 0 && _process$env2["SENTRY_TEST_OVERRIDE_TEMP_DIR"])) {
9554
9593
  void startSpan({
9555
9594
  name: "cleanup",
9556
9595
  scope: sentryScope
9557
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
9558
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9559
- while (1) switch (_context16.prev = _context16.next) {
9596
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
9597
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9598
+ while (1) switch (_context17.prev = _context17.next) {
9560
9599
  case 0:
9561
9600
  if (!folderToCleanUp) {
9562
- _context16.next = 3;
9601
+ _context17.next = 3;
9563
9602
  break;
9564
9603
  }
9565
- _context16.next = 3;
9604
+ _context17.next = 3;
9566
9605
  return fs__namespace.promises.rm(folderToCleanUp, {
9567
9606
  recursive: true,
9568
9607
  force: true
9569
9608
  });
9570
9609
  case 3:
9571
9610
  case "end":
9572
- return _context16.stop();
9611
+ return _context17.stop();
9573
9612
  }
9574
- }, _callee16);
9613
+ }, _callee17);
9575
9614
  })));
9576
9615
  }
9577
9616
  freeUploadDependencyOnBuildArtifacts();
9578
- _context17.next = 36;
9617
+ _context18.next = 42;
9579
9618
  return safeFlushTelemetry(sentryClient);
9580
- case 36:
9581
- return _context17.finish(31);
9582
- case 37:
9619
+ case 42:
9620
+ return _context18.finish(37);
9621
+ case 43:
9583
9622
  case "end":
9584
- return _context17.stop();
9623
+ return _context18.stop();
9585
9624
  }
9586
- }, _callee17, null, [[1, 27, 31, 37]]);
9625
+ }, _callee18, null, [[2, 33, 37, 43]]);
9587
9626
  })));
9588
9627
  case 4:
9589
9628
  case "end":
9590
- return _context18.stop();
9629
+ return _context19.stop();
9591
9630
  }
9592
- }, _callee18);
9631
+ }, _callee19);
9593
9632
  }))();
9594
9633
  },
9595
9634
  /**
9596
9635
  * Will delete artifacts based on the passed `sourcemaps.filesToDeleteAfterUpload` option.
9597
9636
  */
9598
9637
  deleteArtifacts: function deleteArtifacts() {
9599
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
9638
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
9600
9639
  var _options$sourcemaps5, filesToDelete, filePathsToDelete;
9601
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
9602
- while (1) switch (_context19.prev = _context19.next) {
9640
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
9641
+ while (1) switch (_context20.prev = _context20.next) {
9603
9642
  case 0:
9604
- _context19.prev = 0;
9605
- _context19.next = 3;
9643
+ _context20.prev = 0;
9644
+ _context20.next = 3;
9606
9645
  return (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.filesToDeleteAfterUpload;
9607
9646
  case 3:
9608
- filesToDelete = _context19.sent;
9647
+ filesToDelete = _context20.sent;
9609
9648
  if (!(filesToDelete !== undefined)) {
9610
- _context19.next = 14;
9649
+ _context20.next = 14;
9611
9650
  break;
9612
9651
  }
9613
- _context19.next = 7;
9652
+ _context20.next = 7;
9614
9653
  return glob.glob(filesToDelete, {
9615
9654
  absolute: true,
9616
9655
  nodir: true
9617
9656
  });
9618
9657
  case 7:
9619
- filePathsToDelete = _context19.sent;
9658
+ filePathsToDelete = _context20.sent;
9620
9659
  logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
9621
- _context19.next = 11;
9660
+ _context20.next = 11;
9622
9661
  return waitUntilBuildArtifactDependenciesAreFreed();
9623
9662
  case 11:
9624
9663
  filePathsToDelete.forEach(function (filePathToDelete) {
9625
9664
  logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
9626
9665
  });
9627
- _context19.next = 14;
9666
+ _context20.next = 14;
9628
9667
  return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
9629
9668
  return fs__namespace.promises.rm(filePathToDelete, {
9630
9669
  force: true
@@ -9634,23 +9673,23 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9634
9673
  });
9635
9674
  }));
9636
9675
  case 14:
9637
- _context19.next = 22;
9676
+ _context20.next = 22;
9638
9677
  break;
9639
9678
  case 16:
9640
- _context19.prev = 16;
9641
- _context19.t0 = _context19["catch"](0);
9679
+ _context20.prev = 16;
9680
+ _context20.t0 = _context20["catch"](0);
9642
9681
  sentryScope.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
9643
- _context19.next = 21;
9682
+ _context20.next = 21;
9644
9683
  return safeFlushTelemetry(sentryClient);
9645
9684
  case 21:
9646
9685
  // We throw by default if we get here b/c not being able to delete
9647
9686
  // source maps could leak them to production
9648
- handleRecoverableError(_context19.t0, true);
9687
+ handleRecoverableError(_context20.t0, true);
9649
9688
  case 22:
9650
9689
  case "end":
9651
- return _context19.stop();
9690
+ return _context20.stop();
9652
9691
  }
9653
- }, _callee19, null, [[0, 16]]);
9692
+ }, _callee20, null, [[0, 16]]);
9654
9693
  }))();
9655
9694
  },
9656
9695
  createDependencyOnBuildArtifacts: createDependencyOnBuildArtifacts