@sentry/bundler-plugin-core 2.20.1 → 2.21.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
@@ -13659,7 +13659,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
13659
13659
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
13660
13660
  tracesSampleRate: 1,
13661
13661
  sampleRate: 1,
13662
- release: "2.20.1",
13662
+ release: "2.21.0",
13663
13663
  integrations: [],
13664
13664
  tracePropagationTargets: ["sentry.io/api"],
13665
13665
  stackParser: defaultStackParser,
@@ -13747,6 +13747,7 @@ function setTelemetryDataOnHub(options, hub, bundler) {
13747
13747
  hub.setTag("custom-error-handler", !!errorHandler);
13748
13748
  hub.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
13749
13749
  hub.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
13750
+ hub.setTag("sourcemaps-disabled", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.disable));
13750
13751
  hub.setTag("react-annotate", !!(reactComponentAnnotation !== null && reactComponentAnnotation !== void 0 && reactComponentAnnotation.enabled));
13751
13752
  hub.setTag("node", process.version);
13752
13753
  hub.setTag("platform", process.platform);
@@ -14471,60 +14472,71 @@ function fileDeletionPlugin(_ref) {
14471
14472
  filesToDeleteAfterUpload = _ref.filesToDeleteAfterUpload,
14472
14473
  dependenciesAreFreedPromise = _ref.dependenciesAreFreedPromise,
14473
14474
  logger = _ref.logger;
14474
- return {
14475
- name: "sentry-file-deletion-plugin",
14476
- writeBundle: function writeBundle() {
14477
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14478
- var filePathsToDelete;
14479
- return _regeneratorRuntime().wrap(function _callee$(_context) {
14480
- while (1) switch (_context.prev = _context.next) {
14481
- case 0:
14482
- _context.prev = 0;
14483
- if (!(filesToDeleteAfterUpload !== undefined)) {
14484
- _context.next = 11;
14485
- break;
14486
- }
14487
- _context.next = 4;
14488
- return glob.glob(filesToDeleteAfterUpload, {
14489
- absolute: true,
14490
- nodir: true
14491
- });
14492
- case 4:
14493
- filePathsToDelete = _context.sent;
14494
- logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
14495
- _context.next = 8;
14496
- return dependenciesAreFreedPromise;
14497
- case 8:
14498
- filePathsToDelete.forEach(function (filePathToDelete) {
14499
- logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
14500
- });
14475
+ var writeBundle = /*#__PURE__*/function () {
14476
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14477
+ var filePathsToDelete;
14478
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
14479
+ while (1) switch (_context.prev = _context.next) {
14480
+ case 0:
14481
+ _context.prev = 0;
14482
+ if (!(filesToDeleteAfterUpload !== undefined)) {
14501
14483
  _context.next = 11;
14502
- return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
14503
- return fs__default["default"].promises.rm(filePathToDelete, {
14504
- force: true
14505
- })["catch"](function (e) {
14506
- // This is allowed to fail - we just don't do anything
14507
- logger.debug("An error occurred while attempting to delete asset: ".concat(filePathToDelete), e);
14508
- });
14509
- }));
14510
- case 11:
14511
- _context.next = 19;
14512
14484
  break;
14513
- case 13:
14514
- _context.prev = 13;
14515
- _context.t0 = _context["catch"](0);
14516
- sentryHub.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
14517
- _context.next = 18;
14518
- return safeFlushTelemetry(sentryClient);
14519
- case 18:
14520
- handleRecoverableError(_context.t0);
14521
- case 19:
14522
- case "end":
14523
- return _context.stop();
14524
- }
14525
- }, _callee, null, [[0, 13]]);
14526
- }))();
14527
- }
14485
+ }
14486
+ _context.next = 4;
14487
+ return glob.glob(filesToDeleteAfterUpload, {
14488
+ absolute: true,
14489
+ nodir: true
14490
+ });
14491
+ case 4:
14492
+ filePathsToDelete = _context.sent;
14493
+ logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
14494
+ _context.next = 8;
14495
+ return dependenciesAreFreedPromise;
14496
+ case 8:
14497
+ filePathsToDelete.forEach(function (filePathToDelete) {
14498
+ logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
14499
+ });
14500
+ _context.next = 11;
14501
+ return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
14502
+ return fs__default["default"].promises.rm(filePathToDelete, {
14503
+ force: true
14504
+ })["catch"](function (e) {
14505
+ // This is allowed to fail - we just don't do anything
14506
+ logger.debug("An error occurred while attempting to delete asset: ".concat(filePathToDelete), e);
14507
+ });
14508
+ }));
14509
+ case 11:
14510
+ _context.next = 19;
14511
+ break;
14512
+ case 13:
14513
+ _context.prev = 13;
14514
+ _context.t0 = _context["catch"](0);
14515
+ sentryHub.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
14516
+ _context.next = 18;
14517
+ return safeFlushTelemetry(sentryClient);
14518
+ case 18:
14519
+ handleRecoverableError(_context.t0);
14520
+ case 19:
14521
+ case "end":
14522
+ return _context.stop();
14523
+ }
14524
+ }, _callee, null, [[0, 13]]);
14525
+ }));
14526
+ return function writeBundle() {
14527
+ return _ref2.apply(this, arguments);
14528
+ };
14529
+ }();
14530
+ return {
14531
+ name: "sentry-file-deletion-plugin",
14532
+ vite: {
14533
+ writeBundle: {
14534
+ sequential: true,
14535
+ order: "post",
14536
+ handler: writeBundle
14537
+ }
14538
+ },
14539
+ writeBundle: writeBundle
14528
14540
  };
14529
14541
  }
14530
14542
 
@@ -14562,7 +14574,7 @@ function sentryUnpluginFactory(_ref) {
14562
14574
  debugIdUploadPlugin = _ref.debugIdUploadPlugin,
14563
14575
  bundleSizeOptimizationsPlugin = _ref.bundleSizeOptimizationsPlugin;
14564
14576
  return unplugin.createUnplugin(function () {
14565
- var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug, _userOptions$_experim, _options$sourcemaps$f, _options$sourcemaps4, _options$sourcemaps5;
14577
+ var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug, _userOptions$_experim, _options$sourcemaps, _options$sourcemaps$f, _options$sourcemaps5, _options$sourcemaps6;
14566
14578
  var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14567
14579
  var unpluginMetaContext = arguments.length > 1 ? arguments[1] : undefined;
14568
14580
  var logger = createLogger({
@@ -14612,7 +14624,7 @@ function sentryUnpluginFactory(_ref) {
14612
14624
  });
14613
14625
 
14614
14626
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
14615
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.20.1");
14627
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.21.0");
14616
14628
  function handleRecoverableError(unknownError) {
14617
14629
  sentrySession.status = "abnormal";
14618
14630
  try {
@@ -14748,7 +14760,9 @@ function sentryUnpluginFactory(_ref) {
14748
14760
  var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
14749
14761
  plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
14750
14762
  }
14751
- if (!options.release.name) {
14763
+ if ((_options$sourcemaps = options.sourcemaps) !== null && _options$sourcemaps !== void 0 && _options$sourcemaps.disable) {
14764
+ logger.debug("Source map upload was disabled. Will not upload sourcemaps.");
14765
+ } else if (!options.release.name) {
14752
14766
  logger.warn("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
14753
14767
  } else if (!options.authToken) {
14754
14768
  logger.warn("No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/");
@@ -14789,16 +14803,16 @@ function sentryUnpluginFactory(_ref) {
14789
14803
  } else if (!options.project) {
14790
14804
  logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug.");
14791
14805
  } else {
14792
- var _options$sourcemaps, _options$sourcemaps2, _options$sourcemaps3;
14806
+ var _options$sourcemaps2, _options$sourcemaps3, _options$sourcemaps4;
14793
14807
  plugins.push(debugIdUploadPlugin(createDebugIdUploadFunction({
14794
- assets: (_options$sourcemaps = options.sourcemaps) === null || _options$sourcemaps === void 0 ? void 0 : _options$sourcemaps.assets,
14795
- ignore: (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.ignore,
14808
+ assets: (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.assets,
14809
+ ignore: (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.ignore,
14796
14810
  freeDependencyOnSourcemapFiles: createDependencyOnSourcemapFiles(),
14797
14811
  dist: options.release.dist,
14798
14812
  releaseName: options.release.name,
14799
14813
  logger: logger,
14800
14814
  handleRecoverableError: handleRecoverableError,
14801
- rewriteSourcesHook: (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.rewriteSources,
14815
+ rewriteSourcesHook: (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.rewriteSources,
14802
14816
  sentryHub: sentryHub,
14803
14817
  sentryClient: sentryClient,
14804
14818
  sentryCliOptions: {
@@ -14825,7 +14839,7 @@ function sentryUnpluginFactory(_ref) {
14825
14839
  // It is very important that this is only called after all other dependencies have been created with `createDependencyOnSourcemapFiles`.
14826
14840
  // Ideally, we always register this plugin last.
14827
14841
  dependenciesAreFreedPromise: waitUntilSourcemapFileDependenciesAreFreed(),
14828
- filesToDeleteAfterUpload: (_options$sourcemaps$f = (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.filesToDeleteAfterUpload) !== null && _options$sourcemaps$f !== void 0 ? _options$sourcemaps$f : (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.deleteFilesAfterUpload,
14842
+ filesToDeleteAfterUpload: (_options$sourcemaps$f = (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.filesToDeleteAfterUpload) !== null && _options$sourcemaps$f !== void 0 ? _options$sourcemaps$f : (_options$sourcemaps6 = options.sourcemaps) === null || _options$sourcemaps6 === void 0 ? void 0 : _options$sourcemaps6.deleteFilesAfterUpload,
14829
14843
  logger: logger,
14830
14844
  handleRecoverableError: handleRecoverableError,
14831
14845
  sentryHub: sentryHub,