@sentry/bundler-plugin-core 2.13.0 → 2.14.1

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
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var SentryCli = require('@sentry/cli');
6
6
  var core = require('@babel/core');
7
- var babelPluginComponentAnnotate = require('@sentry/babel-plugin-component-annotate');
7
+ var componentNameAnnotatePlugin = require('@sentry/babel-plugin-component-annotate');
8
8
  var fs = require('fs');
9
9
  var path = require('path');
10
10
  var MagicString = require('magic-string');
@@ -40,6 +40,7 @@ function _interopNamespace(e) {
40
40
  }
41
41
 
42
42
  var SentryCli__default = /*#__PURE__*/_interopDefaultLegacy(SentryCli);
43
+ var componentNameAnnotatePlugin__default = /*#__PURE__*/_interopDefaultLegacy(componentNameAnnotatePlugin);
43
44
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
44
45
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
45
46
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
@@ -375,6 +376,15 @@ function _regeneratorRuntime() {
375
376
  }
376
377
  }, exports;
377
378
  }
379
+ function _typeof(obj) {
380
+ "@babel/helpers - typeof";
381
+
382
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
383
+ return typeof obj;
384
+ } : function (obj) {
385
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
386
+ }, _typeof(obj);
387
+ }
378
388
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
379
389
  try {
380
390
  var info = gen[key](arg);
@@ -740,7 +750,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
740
750
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
741
751
  tracesSampleRate: 1,
742
752
  sampleRate: 1,
743
- release: "2.13.0",
753
+ release: "2.14.1",
744
754
  integrations: [],
745
755
  tracePropagationTargets: ["sentry.io/api"],
746
756
  stackParser: node.defaultStackParser,
@@ -805,7 +815,8 @@ function setTelemetryDataOnHub(options, hub, bundler) {
805
815
  project = options.project,
806
816
  release = options.release,
807
817
  errorHandler = options.errorHandler,
808
- sourcemaps = options.sourcemaps;
818
+ sourcemaps = options.sourcemaps,
819
+ reactComponentAnnotation = options.reactComponentAnnotation;
809
820
  hub.setTag("upload-legacy-sourcemaps", !!release.uploadLegacySourcemaps);
810
821
  if (release.uploadLegacySourcemaps) {
811
822
  hub.setTag("uploadLegacySourcemapsEntries", Array.isArray(release.uploadLegacySourcemaps) ? release.uploadLegacySourcemaps.length : 1);
@@ -827,6 +838,7 @@ function setTelemetryDataOnHub(options, hub, bundler) {
827
838
  hub.setTag("custom-error-handler", !!errorHandler);
828
839
  hub.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
829
840
  hub.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
841
+ hub.setTag("react-annotate", !!(reactComponentAnnotation !== null && reactComponentAnnotation !== void 0 && reactComponentAnnotation.enabled));
830
842
  hub.setTag("node", process.version);
831
843
  hub.setTag("platform", process.platform);
832
844
  hub.setTags({
@@ -1618,17 +1630,17 @@ function sentryUnpluginFactory(_ref) {
1618
1630
  silent: (_userOptions$silent = userOptions.silent) !== null && _userOptions$silent !== void 0 ? _userOptions$silent : false,
1619
1631
  debug: (_userOptions$debug = userOptions.debug) !== null && _userOptions$debug !== void 0 ? _userOptions$debug : false
1620
1632
  });
1621
- var dotenvResult = dotenv__namespace.config({
1622
- path: path__namespace.join(process.cwd(), ".env.sentry-build-plugin")
1623
- });
1624
-
1625
- // Ignore "file not found" errors but throw all others
1626
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1627
- // @ts-ignore Accessing `code` on error should be safe
1628
- if (dotenvResult.error && dotenvResult.error.code !== "ENOENT") {
1629
- throw dotenvResult.error;
1630
- } else if (dotenvResult.parsed) {
1633
+ try {
1634
+ var dotenvFile = fs__namespace.readFileSync(path__namespace.join(process.cwd(), ".env.sentry-build-plugin"), "utf-8");
1635
+ // NOTE: Do not use the dotenv.config API directly to read the dotenv file! For some ungodly reason, it falls back to reading `${process.cwd()}/.env` which is absolutely not what we want.
1636
+ var dotenvResult = dotenv__namespace.parse(dotenvFile);
1637
+ process.env = _objectSpread2(_objectSpread2({}, process.env), dotenvResult);
1631
1638
  logger.info('Using environment variables configured in ".env.sentry-build-plugin".');
1639
+ } catch (e) {
1640
+ // Ignore "file not found" errors but throw all others
1641
+ if (_typeof(e) === "object" && e && "code" in e && e.code !== "ENOENT") {
1642
+ throw e;
1643
+ }
1632
1644
  }
1633
1645
  var options = normalizeUserOptions(userOptions);
1634
1646
  if (unpluginMetaContext.watchMode || options.disable) {
@@ -1652,7 +1664,7 @@ function sentryUnpluginFactory(_ref) {
1652
1664
  });
1653
1665
 
1654
1666
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
1655
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.13.0");
1667
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.14.1");
1656
1668
  function handleRecoverableError(unknownError) {
1657
1669
  sentrySession.status = "abnormal";
1658
1670
  try {
@@ -2061,7 +2073,7 @@ function createComponentNameAnnotateHooks() {
2061
2073
  _context2.prev = 7;
2062
2074
  _context2.next = 10;
2063
2075
  return core.transformAsync(code, {
2064
- plugins: [[babelPluginComponentAnnotate.componentNameAnnotatePlugin]],
2076
+ plugins: [[componentNameAnnotatePlugin__default["default"]]],
2065
2077
  filename: id,
2066
2078
  parserOpts: {
2067
2079
  sourceType: "module",