@sentry/bundler-plugin-core 2.6.0 → 2.6.2

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
@@ -863,6 +863,9 @@ function createDebugIdUploadFunction(_ref) {
863
863
  return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
864
864
  return fs__default["default"].promises.rm(filePathToDelete, {
865
865
  force: true
866
+ })["catch"](function (e) {
867
+ // This is allowed to fail - we just don't do anything
868
+ logger.debug("An error occured while attempting to delete asset: ".concat(filePathToDelete), e);
866
869
  });
867
870
  }));
868
871
  case 53:
@@ -1000,43 +1003,72 @@ function determineSourceMapPathFromBundle(_x9, _x10, _x11) {
1000
1003
  */
1001
1004
  function _determineSourceMapPathFromBundle() {
1002
1005
  _determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(bundlePath, bundleSource, logger) {
1003
- var sourceMappingUrlMatch, sourceMappingUrl, adjacentSourceMapFilePath;
1006
+ var sourceMappingUrlMatch, sourceMappingUrl, isUrl, isSupportedUrl, url, absoluteSourceMapPath, adjacentSourceMapFilePath;
1004
1007
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1005
1008
  while (1) switch (_context5.prev = _context5.next) {
1006
1009
  case 0:
1007
1010
  // 1. try to find source map at `sourceMappingURL` location
1008
- sourceMappingUrlMatch = bundleSource.match(/^\/\/# sourceMappingURL=(.*)$/);
1011
+ sourceMappingUrlMatch = bundleSource.match(/^\s*\/\/# sourceMappingURL=(.*)$/m);
1009
1012
  if (!sourceMappingUrlMatch) {
1010
- _context5.next = 8;
1013
+ _context5.next = 21;
1011
1014
  break;
1012
1015
  }
1013
1016
  sourceMappingUrl = path__default["default"].normalize(sourceMappingUrlMatch[1]);
1014
- if (!path__default["default"].isAbsolute(sourceMappingUrl)) {
1015
- _context5.next = 7;
1017
+ try {
1018
+ url = new URL(sourceMappingUrl);
1019
+ isUrl = true;
1020
+ isSupportedUrl = url.protocol === "file:";
1021
+ } catch (_unused) {
1022
+ isUrl = false;
1023
+ isSupportedUrl = false;
1024
+ }
1025
+ if (!isSupportedUrl) {
1026
+ _context5.next = 8;
1016
1027
  break;
1017
1028
  }
1018
- return _context5.abrupt("return", sourceMappingUrl);
1019
- case 7:
1020
- return _context5.abrupt("return", path__default["default"].join(path__default["default"].dirname(bundlePath), sourceMappingUrl));
1029
+ absoluteSourceMapPath = sourceMappingUrl;
1030
+ _context5.next = 13;
1031
+ break;
1021
1032
  case 8:
1022
- _context5.prev = 8;
1033
+ if (!isUrl) {
1034
+ _context5.next = 12;
1035
+ break;
1036
+ }
1037
+ return _context5.abrupt("return");
1038
+ case 12:
1039
+ if (path__default["default"].isAbsolute(sourceMappingUrl)) {
1040
+ absoluteSourceMapPath = sourceMappingUrl;
1041
+ } else {
1042
+ absoluteSourceMapPath = path__default["default"].join(path__default["default"].dirname(bundlePath), sourceMappingUrl);
1043
+ }
1044
+ case 13:
1045
+ _context5.prev = 13;
1046
+ _context5.next = 16;
1047
+ return util__namespace.promisify(fs__default["default"].access)(absoluteSourceMapPath);
1048
+ case 16:
1049
+ return _context5.abrupt("return", absoluteSourceMapPath);
1050
+ case 19:
1051
+ _context5.prev = 19;
1052
+ _context5.t0 = _context5["catch"](13);
1053
+ case 21:
1054
+ _context5.prev = 21;
1023
1055
  adjacentSourceMapFilePath = bundlePath + ".map";
1024
- _context5.next = 12;
1056
+ _context5.next = 25;
1025
1057
  return util__namespace.promisify(fs__default["default"].access)(adjacentSourceMapFilePath);
1026
- case 12:
1058
+ case 25:
1027
1059
  return _context5.abrupt("return", adjacentSourceMapFilePath);
1028
- case 15:
1029
- _context5.prev = 15;
1030
- _context5.t0 = _context5["catch"](8);
1031
- case 17:
1060
+ case 28:
1061
+ _context5.prev = 28;
1062
+ _context5.t1 = _context5["catch"](21);
1063
+ case 30:
1032
1064
  // This is just a debug message because it can be quite spammy for some frameworks
1033
1065
  logger.debug("Could not determine source map path for bundle: ".concat(bundlePath, " - Did you turn on source map generation in your bundler?"));
1034
1066
  return _context5.abrupt("return", undefined);
1035
- case 19:
1067
+ case 32:
1036
1068
  case "end":
1037
1069
  return _context5.stop();
1038
1070
  }
1039
- }, _callee5, null, [[8, 15]]);
1071
+ }, _callee5, null, [[13, 19], [21, 28]]);
1040
1072
  }));
1041
1073
  return _determineSourceMapPathFromBundle.apply(this, arguments);
1042
1074
  }
@@ -1300,7 +1332,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
1300
1332
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
1301
1333
  tracesSampleRate: 1,
1302
1334
  sampleRate: 1,
1303
- release: "2.6.0",
1335
+ release: "2.6.2",
1304
1336
  integrations: [],
1305
1337
  tracePropagationTargets: ["sentry.io/api"],
1306
1338
  stackParser: node.defaultStackParser,
@@ -1370,6 +1402,8 @@ function setTelemetryDataOnHub(options, hub, bundler) {
1370
1402
  if (release.uploadLegacySourcemaps) {
1371
1403
  hub.setTag("uploadLegacySourcemapsEntries", Array.isArray(release.uploadLegacySourcemaps) ? release.uploadLegacySourcemaps.length : 1);
1372
1404
  }
1405
+ hub.setTag("module-metadata", !!options._experiments.moduleMetadata);
1406
+ hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);
1373
1407
 
1374
1408
  // Optional release pipeline steps
1375
1409
  hub.setTag("clean-artifacts", release.cleanArtifacts);
@@ -1530,7 +1564,7 @@ function sentryUnpluginFactory(_ref) {
1530
1564
  });
1531
1565
 
1532
1566
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
1533
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.6.0");
1567
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.6.2");
1534
1568
  function handleRecoverableError(unknownError) {
1535
1569
  sentrySession.status = "abnormal";
1536
1570
  try {