@sentry/bundler-plugin-core 2.3.0 → 2.4.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
@@ -15,6 +15,7 @@ var glob = require('glob');
15
15
  var util = require('util');
16
16
  var utils = require('@sentry/utils');
17
17
  var node = require('@sentry/node');
18
+ var dotenv = require('dotenv');
18
19
 
19
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
21
 
@@ -47,6 +48,7 @@ var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
47
48
  var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
48
49
  var childProcess__default = /*#__PURE__*/_interopDefaultLegacy(childProcess);
49
50
  var util__namespace = /*#__PURE__*/_interopNamespace(util);
51
+ var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
50
52
 
51
53
  function ownKeys(object, enumerableOnly) {
52
54
  var keys = Object.keys(object);
@@ -579,7 +581,7 @@ function stringToUUID(str) {
579
581
  function determineReleaseName() {
580
582
  var gitRevision;
581
583
  try {
582
- gitRevision = childProcess__default["default"].execSync("git rev-parse --short HEAD").toString().trim();
584
+ gitRevision = childProcess__default["default"].execSync("git rev-parse HEAD").toString().trim();
583
585
  } catch (e) {
584
586
  // noop
585
587
  }
@@ -1291,7 +1293,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
1291
1293
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
1292
1294
  tracesSampleRate: 1,
1293
1295
  sampleRate: 1,
1294
- release: "2.3.0",
1296
+ release: "2.4.0",
1295
1297
  integrations: [],
1296
1298
  tracePropagationTargets: ["sentry.io/api"],
1297
1299
  stackParser: node.defaultStackParser,
@@ -1480,6 +1482,24 @@ function sentryUnpluginFactory(_ref) {
1480
1482
  debugIdInjectionPlugin = _ref.debugIdInjectionPlugin,
1481
1483
  debugIdUploadPlugin = _ref.debugIdUploadPlugin;
1482
1484
  return unplugin.createUnplugin(function (userOptions, unpluginMetaContext) {
1485
+ var _userOptions$silent, _userOptions$debug;
1486
+ var logger = createLogger({
1487
+ prefix: "[sentry-".concat(unpluginMetaContext.framework, "-plugin]"),
1488
+ silent: (_userOptions$silent = userOptions.silent) !== null && _userOptions$silent !== void 0 ? _userOptions$silent : false,
1489
+ debug: (_userOptions$debug = userOptions.debug) !== null && _userOptions$debug !== void 0 ? _userOptions$debug : false
1490
+ });
1491
+ var dotenvResult = dotenv__namespace.config({
1492
+ path: path__namespace.join(process.cwd(), ".env.sentry-build-plugin")
1493
+ });
1494
+
1495
+ // Ignore "file not found" errors but throw all others
1496
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1497
+ // @ts-ignore Accessing `code` on error should be safe
1498
+ if (dotenvResult.error && dotenvResult.error.code !== "ENOENT") {
1499
+ throw dotenvResult.error;
1500
+ } else if (dotenvResult.parsed) {
1501
+ logger.info('Using environment variables configured in ".env.sentry-build-plugin".');
1502
+ }
1483
1503
  var options = normalizeUserOptions(userOptions);
1484
1504
  if (unpluginMetaContext.watchMode || options.disable) {
1485
1505
  return [{
@@ -1500,14 +1520,9 @@ function sentryUnpluginFactory(_ref) {
1500
1520
  sentEndSession = true;
1501
1521
  }
1502
1522
  });
1503
- var logger = createLogger({
1504
- prefix: "[sentry-".concat(unpluginMetaContext.framework, "-plugin]"),
1505
- silent: options.silent,
1506
- debug: options.debug
1507
- });
1508
1523
 
1509
1524
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
1510
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.3.0");
1525
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.4.0");
1511
1526
  function handleRecoverableError(unknownError) {
1512
1527
  sentrySession.status = "abnormal";
1513
1528
  try {