@sentry/bundler-plugin-core 2.10.2 → 2.11.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
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var SentryCli = require('@sentry/cli');
6
+ var core = require('@babel/core');
7
+ var componentAnnotatePlugin = require('@sentry/component-annotate-plugin');
6
8
  var fs = require('fs');
7
9
  var path = require('path');
8
10
  var MagicString = require('magic-string');
@@ -13,7 +15,7 @@ var crypto = require('crypto');
13
15
  var childProcess = require('child_process');
14
16
  var glob = require('glob');
15
17
  var util = require('util');
16
- var utils = require('@sentry/utils');
18
+ var pkg = require('@sentry/utils');
17
19
  var node = require('@sentry/node');
18
20
  var dotenv = require('dotenv');
19
21
 
@@ -48,6 +50,7 @@ var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
48
50
  var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
49
51
  var childProcess__default = /*#__PURE__*/_interopDefaultLegacy(childProcess);
50
52
  var util__namespace = /*#__PURE__*/_interopNamespace(util);
53
+ var pkg__default = /*#__PURE__*/_interopDefaultLegacy(pkg);
51
54
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
52
55
 
53
56
  function ownKeys(object, enumerableOnly) {
@@ -694,6 +697,7 @@ function normalizeUserOptions(userOptions) {
694
697
  cleanArtifacts: (_userOptions$release$6 = (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.cleanArtifacts) !== null && _userOptions$release$6 !== void 0 ? _userOptions$release$6 : false
695
698
  }),
696
699
  bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
700
+ reactComponentAnnotation: userOptions.reactComponentAnnotation,
697
701
  _experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
698
702
  };
699
703
  return options;
@@ -730,6 +734,200 @@ function validateOptions(options, logger) {
730
734
  return true;
731
735
  }
732
736
 
737
+ var SENTRY_SAAS_HOSTNAME = "sentry.io";
738
+ function createSentryInstance(options, shouldSendTelemetry, bundler) {
739
+ var client = new node.NodeClient({
740
+ dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
741
+ tracesSampleRate: 1,
742
+ sampleRate: 1,
743
+ release: "2.11.0",
744
+ integrations: [],
745
+ tracePropagationTargets: ["sentry.io/api"],
746
+ stackParser: node.defaultStackParser,
747
+ beforeSend: function beforeSend(event) {
748
+ var _event$exception, _event$exception$valu;
749
+ (_event$exception = event.exception) === null || _event$exception === void 0 ? void 0 : (_event$exception$valu = _event$exception.values) === null || _event$exception$valu === void 0 ? void 0 : _event$exception$valu.forEach(function (exception) {
750
+ delete exception.stacktrace;
751
+ });
752
+ delete event.server_name; // Server name might contain PII
753
+ return event;
754
+ },
755
+ beforeSendTransaction: function beforeSendTransaction(event) {
756
+ delete event.server_name; // Server name might contain PII
757
+ return event;
758
+ },
759
+ // We create a transport that stalls sending events until we know that we're allowed to (i.e. when Sentry CLI told
760
+ // us that the upload URL is the Sentry SaaS URL)
761
+ transport: function transport(nodeTransportOptions) {
762
+ var nodeTransport = node.makeNodeTransport(nodeTransportOptions);
763
+ return {
764
+ flush: function flush(timeout) {
765
+ return nodeTransport.flush(timeout);
766
+ },
767
+ send: function () {
768
+ var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
769
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
770
+ while (1) switch (_context.prev = _context.next) {
771
+ case 0:
772
+ _context.next = 2;
773
+ return shouldSendTelemetry;
774
+ case 2:
775
+ if (!_context.sent) {
776
+ _context.next = 6;
777
+ break;
778
+ }
779
+ return _context.abrupt("return", nodeTransport.send(request));
780
+ case 6:
781
+ return _context.abrupt("return", undefined);
782
+ case 7:
783
+ case "end":
784
+ return _context.stop();
785
+ }
786
+ }, _callee);
787
+ }));
788
+ function send(_x) {
789
+ return _send.apply(this, arguments);
790
+ }
791
+ return send;
792
+ }()
793
+ };
794
+ }
795
+ });
796
+ var hub = new node.Hub(client);
797
+ setTelemetryDataOnHub(options, hub, bundler);
798
+ return {
799
+ sentryHub: hub,
800
+ sentryClient: client
801
+ };
802
+ }
803
+ function setTelemetryDataOnHub(options, hub, bundler) {
804
+ var org = options.org,
805
+ project = options.project,
806
+ release = options.release,
807
+ errorHandler = options.errorHandler,
808
+ sourcemaps = options.sourcemaps;
809
+ hub.setTag("upload-legacy-sourcemaps", !!release.uploadLegacySourcemaps);
810
+ if (release.uploadLegacySourcemaps) {
811
+ hub.setTag("uploadLegacySourcemapsEntries", Array.isArray(release.uploadLegacySourcemaps) ? release.uploadLegacySourcemaps.length : 1);
812
+ }
813
+ hub.setTag("module-metadata", !!options._experiments.moduleMetadata);
814
+ hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);
815
+
816
+ // Optional release pipeline steps
817
+ hub.setTag("clean-artifacts", release.cleanArtifacts);
818
+ if (release.setCommits) {
819
+ hub.setTag("set-commits", release.setCommits.auto === true ? "auto" : "manual");
820
+ } else {
821
+ hub.setTag("set-commits", "undefined");
822
+ }
823
+ hub.setTag("finalize-release", release.finalize);
824
+ hub.setTag("deploy-options", !!release.deploy);
825
+
826
+ // Miscelaneous options
827
+ hub.setTag("custom-error-handler", !!errorHandler);
828
+ hub.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
829
+ hub.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
830
+ hub.setTag("node", process.version);
831
+ hub.setTag("platform", process.platform);
832
+ hub.setTags({
833
+ organization: org,
834
+ project: project,
835
+ bundler: bundler
836
+ });
837
+ hub.setUser({
838
+ id: org
839
+ });
840
+ }
841
+ function allowedToSendTelemetry(_x2) {
842
+ return _allowedToSendTelemetry.apply(this, arguments);
843
+ }
844
+
845
+ /**
846
+ * Flushing the SDK client can fail. We never want to crash the plugin because of telemetry.
847
+ */
848
+ function _allowedToSendTelemetry() {
849
+ _allowedToSendTelemetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
850
+ var _cliInfo$split$, _cliInfo$split$$repla;
851
+ var silent, org, project, authToken, url, headers, telemetry, release, cli, cliInfo, cliInfoUrl;
852
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
853
+ while (1) switch (_context2.prev = _context2.next) {
854
+ case 0:
855
+ silent = options.silent, org = options.org, project = options.project, authToken = options.authToken, url = options.url, headers = options.headers, telemetry = options.telemetry, release = options.release; // `options.telemetry` defaults to true
856
+ if (!(telemetry === false)) {
857
+ _context2.next = 3;
858
+ break;
859
+ }
860
+ return _context2.abrupt("return", false);
861
+ case 3:
862
+ if (!(url === SENTRY_SAAS_URL)) {
863
+ _context2.next = 5;
864
+ break;
865
+ }
866
+ return _context2.abrupt("return", true);
867
+ case 5:
868
+ cli = new SentryCli__default["default"](null, {
869
+ url: url,
870
+ authToken: authToken,
871
+ org: org,
872
+ project: project,
873
+ vcsRemote: release.vcsRemote,
874
+ silent: silent,
875
+ headers: headers
876
+ });
877
+ _context2.prev = 6;
878
+ _context2.next = 9;
879
+ return cli.execute(["info"], false);
880
+ case 9:
881
+ cliInfo = _context2.sent;
882
+ _context2.next = 15;
883
+ break;
884
+ case 12:
885
+ _context2.prev = 12;
886
+ _context2.t0 = _context2["catch"](6);
887
+ return _context2.abrupt("return", false);
888
+ case 15:
889
+ cliInfoUrl = (_cliInfo$split$ = cliInfo.split(/(\r\n|\n|\r)/)[0]) === null || _cliInfo$split$ === void 0 ? void 0 : (_cliInfo$split$$repla = _cliInfo$split$.replace(/^Sentry Server: /, "")) === null || _cliInfo$split$$repla === void 0 ? void 0 : _cliInfo$split$$repla.trim();
890
+ if (!(cliInfoUrl === undefined)) {
891
+ _context2.next = 18;
892
+ break;
893
+ }
894
+ return _context2.abrupt("return", false);
895
+ case 18:
896
+ return _context2.abrupt("return", new URL(cliInfoUrl).hostname === SENTRY_SAAS_HOSTNAME);
897
+ case 19:
898
+ case "end":
899
+ return _context2.stop();
900
+ }
901
+ }, _callee2, null, [[6, 12]]);
902
+ }));
903
+ return _allowedToSendTelemetry.apply(this, arguments);
904
+ }
905
+ function safeFlushTelemetry(_x3) {
906
+ return _safeFlushTelemetry.apply(this, arguments);
907
+ }
908
+ function _safeFlushTelemetry() {
909
+ _safeFlushTelemetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sentryClient) {
910
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
911
+ while (1) switch (_context3.prev = _context3.next) {
912
+ case 0:
913
+ _context3.prev = 0;
914
+ _context3.next = 3;
915
+ return sentryClient.flush(2000);
916
+ case 3:
917
+ _context3.next = 7;
918
+ break;
919
+ case 5:
920
+ _context3.prev = 5;
921
+ _context3.t0 = _context3["catch"](0);
922
+ case 7:
923
+ case "end":
924
+ return _context3.stop();
925
+ }
926
+ }, _callee3, null, [[0, 5]]);
927
+ }));
928
+ return _safeFlushTelemetry.apply(this, arguments);
929
+ }
930
+
733
931
  function createDebugIdUploadFunction(_ref) {
734
932
  var assets = _ref.assets,
735
933
  ignore = _ref.ignore,
@@ -879,7 +1077,7 @@ function createDebugIdUploadFunction(_ref) {
879
1077
  headers: _objectSpread2({
880
1078
  "sentry-trace": uploadSpan.toTraceparent(),
881
1079
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
882
- baggage: utils.dynamicSamplingContextToSentryBaggageHeader(artifactBundleUploadTransaction.getDynamicSamplingContext())
1080
+ baggage: pkg.dynamicSamplingContextToSentryBaggageHeader(artifactBundleUploadTransaction.getDynamicSamplingContext())
883
1081
  }, sentryCliOptions.headers)
884
1082
  }));
885
1083
  _context3.next = 45;
@@ -954,7 +1152,7 @@ function createDebugIdUploadFunction(_ref) {
954
1152
  }
955
1153
  artifactBundleUploadTransaction.finish();
956
1154
  _context3.next = 69;
957
- return sentryClient.flush();
1155
+ return safeFlushTelemetry(sentryClient);
958
1156
  case 69:
959
1157
  return _context3.finish(64);
960
1158
  case 70:
@@ -1285,7 +1483,7 @@ function releaseManagementPlugin(_ref) {
1285
1483
  _context.t0 = _context["catch"](0);
1286
1484
  sentryHub.captureException('Error in "releaseManagementPlugin" writeBundle hook');
1287
1485
  _context.next = 28;
1288
- return sentryClient.flush();
1486
+ return safeFlushTelemetry(sentryClient);
1289
1487
  case 28:
1290
1488
  handleRecoverableError(_context.t0);
1291
1489
  case 29:
@@ -1322,7 +1520,7 @@ function telemetryPlugin(_ref) {
1322
1520
  name: "Sentry Bundler Plugin execution"
1323
1521
  }).finish();
1324
1522
  _context.next = 7;
1325
- return sentryClient.flush(3000);
1523
+ return safeFlushTelemetry(sentryClient);
1326
1524
  case 7:
1327
1525
  case "end":
1328
1526
  return _context.stop();
@@ -1378,171 +1576,7 @@ function createLogger(options) {
1378
1576
  };
1379
1577
  }
1380
1578
 
1381
- var SENTRY_SAAS_HOSTNAME = "sentry.io";
1382
- function createSentryInstance(options, shouldSendTelemetry, bundler) {
1383
- var client = new node.NodeClient({
1384
- dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
1385
- tracesSampleRate: 1,
1386
- sampleRate: 1,
1387
- release: "2.10.2",
1388
- integrations: [],
1389
- tracePropagationTargets: ["sentry.io/api"],
1390
- stackParser: node.defaultStackParser,
1391
- beforeSend: function beforeSend(event) {
1392
- var _event$exception, _event$exception$valu;
1393
- (_event$exception = event.exception) === null || _event$exception === void 0 ? void 0 : (_event$exception$valu = _event$exception.values) === null || _event$exception$valu === void 0 ? void 0 : _event$exception$valu.forEach(function (exception) {
1394
- delete exception.stacktrace;
1395
- });
1396
- delete event.server_name; // Server name might contain PII
1397
- return event;
1398
- },
1399
- beforeSendTransaction: function beforeSendTransaction(event) {
1400
- delete event.server_name; // Server name might contain PII
1401
- return event;
1402
- },
1403
- // We create a transport that stalls sending events until we know that we're allowed to (i.e. when Sentry CLI told
1404
- // us that the upload URL is the Sentry SaaS URL)
1405
- transport: function transport(nodeTransportOptions) {
1406
- var nodeTransport = node.makeNodeTransport(nodeTransportOptions);
1407
- return {
1408
- flush: function flush(timeout) {
1409
- return nodeTransport.flush(timeout);
1410
- },
1411
- send: function () {
1412
- var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
1413
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1414
- while (1) switch (_context.prev = _context.next) {
1415
- case 0:
1416
- _context.next = 2;
1417
- return shouldSendTelemetry;
1418
- case 2:
1419
- if (!_context.sent) {
1420
- _context.next = 6;
1421
- break;
1422
- }
1423
- return _context.abrupt("return", nodeTransport.send(request));
1424
- case 6:
1425
- return _context.abrupt("return", undefined);
1426
- case 7:
1427
- case "end":
1428
- return _context.stop();
1429
- }
1430
- }, _callee);
1431
- }));
1432
- function send(_x) {
1433
- return _send.apply(this, arguments);
1434
- }
1435
- return send;
1436
- }()
1437
- };
1438
- }
1439
- });
1440
- var hub = new node.Hub(client);
1441
- setTelemetryDataOnHub(options, hub, bundler);
1442
- return {
1443
- sentryHub: hub,
1444
- sentryClient: client
1445
- };
1446
- }
1447
- function setTelemetryDataOnHub(options, hub, bundler) {
1448
- var org = options.org,
1449
- project = options.project,
1450
- release = options.release,
1451
- errorHandler = options.errorHandler,
1452
- sourcemaps = options.sourcemaps;
1453
- hub.setTag("upload-legacy-sourcemaps", !!release.uploadLegacySourcemaps);
1454
- if (release.uploadLegacySourcemaps) {
1455
- hub.setTag("uploadLegacySourcemapsEntries", Array.isArray(release.uploadLegacySourcemaps) ? release.uploadLegacySourcemaps.length : 1);
1456
- }
1457
- hub.setTag("module-metadata", !!options._experiments.moduleMetadata);
1458
- hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);
1459
-
1460
- // Optional release pipeline steps
1461
- hub.setTag("clean-artifacts", release.cleanArtifacts);
1462
- if (release.setCommits) {
1463
- hub.setTag("set-commits", release.setCommits.auto === true ? "auto" : "manual");
1464
- } else {
1465
- hub.setTag("set-commits", "undefined");
1466
- }
1467
- hub.setTag("finalize-release", release.finalize);
1468
- hub.setTag("deploy-options", !!release.deploy);
1469
-
1470
- // Miscelaneous options
1471
- hub.setTag("custom-error-handler", !!errorHandler);
1472
- hub.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
1473
- hub.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
1474
- hub.setTag("node", process.version);
1475
- hub.setTag("platform", process.platform);
1476
- hub.setTags({
1477
- organization: org,
1478
- project: project,
1479
- bundler: bundler
1480
- });
1481
- hub.setUser({
1482
- id: org
1483
- });
1484
- }
1485
- function allowedToSendTelemetry(_x2) {
1486
- return _allowedToSendTelemetry.apply(this, arguments);
1487
- }
1488
- function _allowedToSendTelemetry() {
1489
- _allowedToSendTelemetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
1490
- var _cliInfo$split$, _cliInfo$split$$repla;
1491
- var silent, org, project, authToken, url, headers, telemetry, release, cli, cliInfo, cliInfoUrl;
1492
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1493
- while (1) switch (_context2.prev = _context2.next) {
1494
- case 0:
1495
- silent = options.silent, org = options.org, project = options.project, authToken = options.authToken, url = options.url, headers = options.headers, telemetry = options.telemetry, release = options.release; // `options.telemetry` defaults to true
1496
- if (!(telemetry === false)) {
1497
- _context2.next = 3;
1498
- break;
1499
- }
1500
- return _context2.abrupt("return", false);
1501
- case 3:
1502
- if (!(url === SENTRY_SAAS_URL)) {
1503
- _context2.next = 5;
1504
- break;
1505
- }
1506
- return _context2.abrupt("return", true);
1507
- case 5:
1508
- cli = new SentryCli__default["default"](null, {
1509
- url: url,
1510
- authToken: authToken,
1511
- org: org,
1512
- project: project,
1513
- vcsRemote: release.vcsRemote,
1514
- silent: silent,
1515
- headers: headers
1516
- });
1517
- _context2.prev = 6;
1518
- _context2.next = 9;
1519
- return cli.execute(["info"], false);
1520
- case 9:
1521
- cliInfo = _context2.sent;
1522
- _context2.next = 15;
1523
- break;
1524
- case 12:
1525
- _context2.prev = 12;
1526
- _context2.t0 = _context2["catch"](6);
1527
- return _context2.abrupt("return", false);
1528
- case 15:
1529
- cliInfoUrl = (_cliInfo$split$ = cliInfo.split(/(\r\n|\n|\r)/)[0]) === null || _cliInfo$split$ === void 0 ? void 0 : (_cliInfo$split$$repla = _cliInfo$split$.replace(/^Sentry Server: /, "")) === null || _cliInfo$split$$repla === void 0 ? void 0 : _cliInfo$split$$repla.trim();
1530
- if (!(cliInfoUrl === undefined)) {
1531
- _context2.next = 18;
1532
- break;
1533
- }
1534
- return _context2.abrupt("return", false);
1535
- case 18:
1536
- return _context2.abrupt("return", new URL(cliInfoUrl).hostname === SENTRY_SAAS_HOSTNAME);
1537
- case 19:
1538
- case "end":
1539
- return _context2.stop();
1540
- }
1541
- }, _callee2, null, [[6, 12]]);
1542
- }));
1543
- return _allowedToSendTelemetry.apply(this, arguments);
1544
- }
1545
-
1579
+ var logger = pkg__default["default"].logger;
1546
1580
  /**
1547
1581
  * The sentry bundler plugin concerns itself with two things:
1548
1582
  * - Release injection
@@ -1572,6 +1606,7 @@ function _allowedToSendTelemetry() {
1572
1606
  */
1573
1607
  function sentryUnpluginFactory(_ref) {
1574
1608
  var releaseInjectionPlugin = _ref.releaseInjectionPlugin,
1609
+ componentNameAnnotatePlugin = _ref.componentNameAnnotatePlugin,
1575
1610
  moduleMetadataInjectionPlugin = _ref.moduleMetadataInjectionPlugin,
1576
1611
  debugIdInjectionPlugin = _ref.debugIdInjectionPlugin,
1577
1612
  debugIdUploadPlugin = _ref.debugIdUploadPlugin,
@@ -1617,7 +1652,7 @@ function sentryUnpluginFactory(_ref) {
1617
1652
  });
1618
1653
 
1619
1654
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
1620
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.10.2");
1655
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.11.0");
1621
1656
  function handleRecoverableError(unknownError) {
1622
1657
  sentrySession.status = "abnormal";
1623
1658
  try {
@@ -1772,6 +1807,15 @@ function sentryUnpluginFactory(_ref) {
1772
1807
  }
1773
1808
  })));
1774
1809
  }
1810
+ if (options.reactComponentAnnotation) {
1811
+ if (!options.reactComponentAnnotation.enabled) {
1812
+ logger.info("The component name annotate plugin is currently disabled. Skipping component name annotations.");
1813
+ } else if (options.reactComponentAnnotation.enabled && !componentNameAnnotatePlugin) {
1814
+ logger.warn("The component name annotate plugin is currently not supported by '@sentry/esbuild-plugin'");
1815
+ } else {
1816
+ componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin());
1817
+ }
1818
+ }
1775
1819
  return plugins;
1776
1820
  });
1777
1821
  }
@@ -1984,10 +2028,79 @@ function createRollupDebugIdUploadHooks(upload) {
1984
2028
  }
1985
2029
  };
1986
2030
  }
2031
+ function createComponentNameAnnotateHooks() {
2032
+ return {
2033
+ transform: function transform(code, id) {
2034
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2035
+ var idWithoutQueryAndHash, parserPlugins, _result$code, result;
2036
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2037
+ while (1) switch (_context2.prev = _context2.next) {
2038
+ case 0:
2039
+ // id may contain query and hash which will trip up our file extension logic below
2040
+ idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
2041
+ if (!idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
2042
+ _context2.next = 3;
2043
+ break;
2044
+ }
2045
+ return _context2.abrupt("return", null);
2046
+ case 3:
2047
+ if ([".jsx", ".tsx"].some(function (ending) {
2048
+ return idWithoutQueryAndHash.endsWith(ending);
2049
+ })) {
2050
+ _context2.next = 5;
2051
+ break;
2052
+ }
2053
+ return _context2.abrupt("return", null);
2054
+ case 5:
2055
+ parserPlugins = [];
2056
+ if (idWithoutQueryAndHash.endsWith(".jsx")) {
2057
+ parserPlugins.push("jsx");
2058
+ } else if (idWithoutQueryAndHash.endsWith(".tsx")) {
2059
+ parserPlugins.push("jsx", "typescript");
2060
+ }
2061
+ _context2.prev = 7;
2062
+ _context2.next = 10;
2063
+ return core.transformAsync(code, {
2064
+ plugins: [[componentAnnotatePlugin.componentNameAnnotatePlugin]],
2065
+ filename: id,
2066
+ parserOpts: {
2067
+ sourceType: "module",
2068
+ allowAwaitOutsideFunction: true,
2069
+ plugins: parserPlugins
2070
+ },
2071
+ generatorOpts: {
2072
+ decoratorsBeforeExport: true
2073
+ },
2074
+ sourceMaps: true
2075
+ });
2076
+ case 10:
2077
+ result = _context2.sent;
2078
+ return _context2.abrupt("return", {
2079
+ code: (_result$code = result === null || result === void 0 ? void 0 : result.code) !== null && _result$code !== void 0 ? _result$code : code,
2080
+ map: result === null || result === void 0 ? void 0 : result.map
2081
+ });
2082
+ case 14:
2083
+ _context2.prev = 14;
2084
+ _context2.t0 = _context2["catch"](7);
2085
+ logger.error("Failed to apply react annotate plugin", _context2.t0);
2086
+ case 17:
2087
+ return _context2.abrupt("return", {
2088
+ code: code
2089
+ });
2090
+ case 18:
2091
+ case "end":
2092
+ return _context2.stop();
2093
+ }
2094
+ }, _callee2, null, [[7, 14]]);
2095
+ }))();
2096
+ }
2097
+ };
2098
+ }
1987
2099
  function getDebugIdSnippet(debugId) {
1988
2100
  return ";!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"".concat(debugId, "\",e._sentryDebugIdIdentifier=\"sentry-dbid-").concat(debugId, "\")}catch(e){}}();");
1989
2101
  }
1990
2102
 
2103
+ exports.createComponentNameAnnotateHooks = createComponentNameAnnotateHooks;
1991
2104
  exports.createRollupBundleSizeOptimizationHooks = createRollupBundleSizeOptimizationHooks;
1992
2105
  exports.createRollupDebugIdInjectionHooks = createRollupDebugIdInjectionHooks;
1993
2106
  exports.createRollupDebugIdUploadHooks = createRollupDebugIdUploadHooks;