@sentry/bundler-plugin-core 3.2.2 → 3.2.4

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.
@@ -705,7 +705,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
705
705
 
706
706
  var SENTRY_SAAS_URL = "https://sentry.io";
707
707
  function normalizeUserOptions(userOptions) {
708
- var _userOptions$org, _userOptions$project, _userOptions$authToke, _ref, _userOptions$url, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$disable, _ref2, _userOptions$release$, _userOptions$release, _userOptions$release$2, _userOptions$release2, _userOptions$release$3, _userOptions$release3, _userOptions$release$4, _userOptions$release4, _ref3, _userOptions$release$5, _userOptions$release5, _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$_experim;
708
+ var _userOptions$org, _userOptions$project, _userOptions$authToke, _ref, _userOptions$url, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$disable, _ref2, _userOptions$release$, _userOptions$release, _userOptions$release$2, _userOptions$release2, _userOptions$release$3, _userOptions$release3, _userOptions$release$4, _userOptions$release4, _ref3, _userOptions$release$5, _userOptions$release5, _userOptions$release6, _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$_experim;
709
709
  var options = {
710
710
  org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
711
711
  project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
@@ -723,7 +723,8 @@ function normalizeUserOptions(userOptions) {
723
723
  inject: (_userOptions$release$2 = (_userOptions$release2 = userOptions.release) === null || _userOptions$release2 === void 0 ? void 0 : _userOptions$release2.inject) !== null && _userOptions$release$2 !== void 0 ? _userOptions$release$2 : true,
724
724
  create: (_userOptions$release$3 = (_userOptions$release3 = userOptions.release) === null || _userOptions$release3 === void 0 ? void 0 : _userOptions$release3.create) !== null && _userOptions$release$3 !== void 0 ? _userOptions$release$3 : true,
725
725
  finalize: (_userOptions$release$4 = (_userOptions$release4 = userOptions.release) === null || _userOptions$release4 === void 0 ? void 0 : _userOptions$release4.finalize) !== null && _userOptions$release$4 !== void 0 ? _userOptions$release$4 : true,
726
- vcsRemote: (_ref3 = (_userOptions$release$5 = (_userOptions$release5 = userOptions.release) === null || _userOptions$release5 === void 0 ? void 0 : _userOptions$release5.vcsRemote) !== null && _userOptions$release$5 !== void 0 ? _userOptions$release$5 : process.env["SENTRY_VSC_REMOTE"]) !== null && _ref3 !== void 0 ? _ref3 : "origin"
726
+ vcsRemote: (_ref3 = (_userOptions$release$5 = (_userOptions$release5 = userOptions.release) === null || _userOptions$release5 === void 0 ? void 0 : _userOptions$release5.vcsRemote) !== null && _userOptions$release$5 !== void 0 ? _userOptions$release$5 : process.env["SENTRY_VSC_REMOTE"]) !== null && _ref3 !== void 0 ? _ref3 : "origin",
727
+ setCommits: (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.setCommits
727
728
  }),
728
729
  bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
729
730
  reactComponentAnnotation: userOptions.reactComponentAnnotation,
@@ -736,6 +737,31 @@ function normalizeUserOptions(userOptions) {
736
737
  moduleMetadata: userOptions.moduleMetadata,
737
738
  _experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
738
739
  };
740
+ if (options.release.setCommits === undefined) {
741
+ if (process.env["VERCEL"] && process.env["VERCEL_GIT_COMMIT_SHA"] && process.env["VERCEL_GIT_REPO_SLUG"] && process.env["VERCEL_GIT_REPO_OWNER"]) {
742
+ options.release.setCommits = {
743
+ shouldNotThrowOnFailure: true,
744
+ commit: process.env["VERCEL_GIT_COMMIT_SHA"],
745
+ previousCommit: process.env["VERCEL_GIT_PREVIOUS_SHA"],
746
+ repo: "".concat(process.env["VERCEL_GIT_REPO_OWNER"], "/").concat(process.env["VERCEL_GIT_REPO_SLUG"]),
747
+ ignoreEmpty: true,
748
+ ignoreMissing: true
749
+ };
750
+ } else {
751
+ options.release.setCommits = {
752
+ shouldNotThrowOnFailure: true,
753
+ auto: true,
754
+ ignoreEmpty: true,
755
+ ignoreMissing: true
756
+ };
757
+ }
758
+ }
759
+ if (options.release.deploy === undefined && process.env["VERCEL"] && process.env["VERCEL_TARGET_ENV"]) {
760
+ options.release.deploy = {
761
+ env: "vercel-".concat(process.env["VERCEL_TARGET_ENV"]),
762
+ url: process.env["VERCEL_URL"] ? "https://".concat(process.env["VERCEL_URL"]) : undefined
763
+ };
764
+ }
739
765
  return options;
740
766
  }
741
767
 
@@ -8075,7 +8101,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
8075
8101
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8076
8102
  tracesSampleRate: 1,
8077
8103
  sampleRate: 1,
8078
- release: "3.2.2",
8104
+ release: "3.2.4",
8079
8105
  integrations: [],
8080
8106
  tracePropagationTargets: ["sentry.io/api"],
8081
8107
  stackParser: stackParser,
@@ -8449,8 +8475,7 @@ function createDebugIdUploadFunction(_ref) {
8449
8475
  paths: [tmpUploadFolder],
8450
8476
  rewrite: false,
8451
8477
  dist: dist
8452
- }],
8453
- useArtifactBundle: true
8478
+ }]
8454
8479
  });
8455
8480
  case 3:
8456
8481
  case "end":
@@ -8765,7 +8790,8 @@ function defaultRewriteSourcesHook(source) {
8765
8790
  * Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
8766
8791
  */
8767
8792
  function releaseManagementPlugin(_ref) {
8768
- var releaseName = _ref.releaseName,
8793
+ var logger = _ref.logger,
8794
+ releaseName = _ref.releaseName,
8769
8795
  include = _ref.include,
8770
8796
  dist = _ref.dist,
8771
8797
  setCommitsOption = _ref.setCommitsOption,
@@ -8822,47 +8848,63 @@ function releaseManagementPlugin(_ref) {
8822
8848
  dist: dist
8823
8849
  });
8824
8850
  case 10:
8825
- if (!setCommitsOption) {
8826
- _context.next = 13;
8851
+ if (!(setCommitsOption !== false)) {
8852
+ _context.next = 23;
8827
8853
  break;
8828
8854
  }
8829
- _context.next = 13;
8855
+ _context.prev = 11;
8856
+ _context.next = 14;
8830
8857
  return cliInstance.releases.setCommits(releaseName, setCommitsOption);
8831
- case 13:
8858
+ case 14:
8859
+ _context.next = 23;
8860
+ break;
8861
+ case 16:
8862
+ _context.prev = 16;
8863
+ _context.t0 = _context["catch"](11);
8864
+ if (!("shouldNotThrowOnFailure" in setCommitsOption && setCommitsOption.shouldNotThrowOnFailure)) {
8865
+ _context.next = 22;
8866
+ break;
8867
+ }
8868
+ logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context.t0);
8869
+ _context.next = 23;
8870
+ break;
8871
+ case 22:
8872
+ throw _context.t0;
8873
+ case 23:
8832
8874
  if (!shouldFinalizeRelease) {
8833
- _context.next = 16;
8875
+ _context.next = 26;
8834
8876
  break;
8835
8877
  }
8836
- _context.next = 16;
8878
+ _context.next = 26;
8837
8879
  return cliInstance.releases.finalize(releaseName);
8838
- case 16:
8880
+ case 26:
8839
8881
  if (!deployOptions) {
8840
- _context.next = 19;
8882
+ _context.next = 29;
8841
8883
  break;
8842
8884
  }
8843
- _context.next = 19;
8885
+ _context.next = 29;
8844
8886
  return cliInstance.releases.newDeploy(releaseName, deployOptions);
8845
- case 19:
8846
- _context.next = 27;
8887
+ case 29:
8888
+ _context.next = 37;
8847
8889
  break;
8848
- case 21:
8849
- _context.prev = 21;
8850
- _context.t0 = _context["catch"](1);
8890
+ case 31:
8891
+ _context.prev = 31;
8892
+ _context.t1 = _context["catch"](1);
8851
8893
  sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
8852
- _context.next = 26;
8894
+ _context.next = 36;
8853
8895
  return safeFlushTelemetry(sentryClient);
8854
- case 26:
8855
- handleRecoverableError(_context.t0, false);
8856
- case 27:
8857
- _context.prev = 27;
8896
+ case 36:
8897
+ handleRecoverableError(_context.t1, false);
8898
+ case 37:
8899
+ _context.prev = 37;
8858
8900
  freeGlobalDependencyOnSourcemapFiles();
8859
8901
  freeWriteBundleInvocationDependencyOnSourcemapFiles();
8860
- return _context.finish(27);
8861
- case 31:
8902
+ return _context.finish(37);
8903
+ case 41:
8862
8904
  case "end":
8863
8905
  return _context.stop();
8864
8906
  }
8865
- }, _callee, null, [[1, 21, 27, 31]]);
8907
+ }, _callee, null, [[1, 31, 37, 41], [11, 16]]);
8866
8908
  }))();
8867
8909
  }
8868
8910
  };
@@ -9122,7 +9164,7 @@ function sentryUnpluginFactory(_ref) {
9122
9164
  });
9123
9165
 
9124
9166
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
9125
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.2");
9167
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.4");
9126
9168
 
9127
9169
  /**
9128
9170
  * Handles errors caught and emitted in various areas of the plugin.
@@ -9278,20 +9320,20 @@ function sentryUnpluginFactory(_ref) {
9278
9320
  plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
9279
9321
  }
9280
9322
  // https://turbo.build/repo/docs/reference/system-environment-variables#environment-variables-in-tasks
9281
- var isRunningInTurboRepo = Boolean(process.env["TURBO_HASH"]);
9282
- var getTruboRepoEnvPassthroughWarning = function getTruboRepoEnvPassthroughWarning(envVarName) {
9283
- return isRunningInTurboRepo ? "\nYou seem to be using Truborepo, did you forget to put ".concat(envVarName, " in `passThroughEnv`? https://turbo.build/repo/docs/reference/configuration#passthroughenv") : "";
9323
+ var isRunningInTurborepo = Boolean(process.env["TURBO_HASH"]);
9324
+ var getTurborepoEnvPassthroughWarning = function getTurborepoEnvPassthroughWarning(envVarName) {
9325
+ return isRunningInTurborepo ? "\nYou seem to be using Turborepo, did you forget to put ".concat(envVarName, " in `passThroughEnv`? https://turbo.build/repo/docs/reference/configuration#passthroughenv") : "";
9284
9326
  };
9285
9327
  if (!options.release.name) {
9286
9328
  logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
9287
9329
  } else if (isDevMode) {
9288
9330
  logger.debug("Running in development mode. Will not create release.");
9289
9331
  } else if (!options.authToken) {
9290
- 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/" + getTruboRepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN"));
9332
+ 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/" + getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN"));
9291
9333
  } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
9292
- logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTruboRepoEnvPassthroughWarning("SENTRY_ORG"));
9334
+ logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
9293
9335
  } else if (!options.project) {
9294
- logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTruboRepoEnvPassthroughWarning("SENTRY_PROJECT"));
9336
+ logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
9295
9337
  } else {
9296
9338
  plugins.push(releaseManagementPlugin({
9297
9339
  logger: logger,
@@ -9299,6 +9341,8 @@ function sentryUnpluginFactory(_ref) {
9299
9341
  shouldCreateRelease: options.release.create,
9300
9342
  shouldFinalizeRelease: options.release.finalize,
9301
9343
  include: options.release.uploadLegacySourcemaps,
9344
+ // setCommits has a default defined by the options mappings
9345
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9302
9346
  setCommitsOption: options.release.setCommits,
9303
9347
  deployOptions: options.release.deploy,
9304
9348
  dist: options.release.dist,
@@ -9325,11 +9369,11 @@ function sentryUnpluginFactory(_ref) {
9325
9369
  } else if (isDevMode) {
9326
9370
  logger.debug("Running in development mode. Will not upload sourcemaps.");
9327
9371
  } else if (!options.authToken) {
9328
- logger.warn("No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" + getTruboRepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN"));
9372
+ logger.warn("No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" + getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN"));
9329
9373
  } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
9330
- logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTruboRepoEnvPassthroughWarning("SENTRY_ORG"));
9374
+ logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
9331
9375
  } else if (!options.project) {
9332
- logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTruboRepoEnvPassthroughWarning("SENTRY_PROJECT"));
9376
+ logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
9333
9377
  } else {
9334
9378
  var _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5;
9335
9379
  // This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins