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