@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.
package/dist/cjs/index.js CHANGED
@@ -741,7 +741,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
741
741
 
742
742
  var SENTRY_SAAS_URL = "https://sentry.io";
743
743
  function normalizeUserOptions(userOptions) {
744
- 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;
744
+ 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;
745
745
  var options = {
746
746
  org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
747
747
  project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
@@ -759,7 +759,8 @@ function normalizeUserOptions(userOptions) {
759
759
  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,
760
760
  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,
761
761
  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,
762
- 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"
762
+ 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",
763
+ setCommits: (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.setCommits
763
764
  }),
764
765
  bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
765
766
  reactComponentAnnotation: userOptions.reactComponentAnnotation,
@@ -772,6 +773,31 @@ function normalizeUserOptions(userOptions) {
772
773
  moduleMetadata: userOptions.moduleMetadata,
773
774
  _experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
774
775
  };
776
+ if (options.release.setCommits === undefined) {
777
+ if (process.env["VERCEL"] && process.env["VERCEL_GIT_COMMIT_SHA"] && process.env["VERCEL_GIT_REPO_SLUG"] && process.env["VERCEL_GIT_REPO_OWNER"]) {
778
+ options.release.setCommits = {
779
+ shouldNotThrowOnFailure: true,
780
+ commit: process.env["VERCEL_GIT_COMMIT_SHA"],
781
+ previousCommit: process.env["VERCEL_GIT_PREVIOUS_SHA"],
782
+ repo: "".concat(process.env["VERCEL_GIT_REPO_OWNER"], "/").concat(process.env["VERCEL_GIT_REPO_SLUG"]),
783
+ ignoreEmpty: true,
784
+ ignoreMissing: true
785
+ };
786
+ } else {
787
+ options.release.setCommits = {
788
+ shouldNotThrowOnFailure: true,
789
+ auto: true,
790
+ ignoreEmpty: true,
791
+ ignoreMissing: true
792
+ };
793
+ }
794
+ }
795
+ if (options.release.deploy === undefined && process.env["VERCEL"] && process.env["VERCEL_TARGET_ENV"]) {
796
+ options.release.deploy = {
797
+ env: "vercel-".concat(process.env["VERCEL_TARGET_ENV"]),
798
+ url: process.env["VERCEL_URL"] ? "https://".concat(process.env["VERCEL_URL"]) : undefined
799
+ };
800
+ }
775
801
  return options;
776
802
  }
777
803
 
@@ -8111,7 +8137,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
8111
8137
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8112
8138
  tracesSampleRate: 1,
8113
8139
  sampleRate: 1,
8114
- release: "3.2.2",
8140
+ release: "3.2.4",
8115
8141
  integrations: [],
8116
8142
  tracePropagationTargets: ["sentry.io/api"],
8117
8143
  stackParser: stackParser,
@@ -8485,8 +8511,7 @@ function createDebugIdUploadFunction(_ref) {
8485
8511
  paths: [tmpUploadFolder],
8486
8512
  rewrite: false,
8487
8513
  dist: dist
8488
- }],
8489
- useArtifactBundle: true
8514
+ }]
8490
8515
  });
8491
8516
  case 3:
8492
8517
  case "end":
@@ -8801,7 +8826,8 @@ function defaultRewriteSourcesHook(source) {
8801
8826
  * Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
8802
8827
  */
8803
8828
  function releaseManagementPlugin(_ref) {
8804
- var releaseName = _ref.releaseName,
8829
+ var logger = _ref.logger,
8830
+ releaseName = _ref.releaseName,
8805
8831
  include = _ref.include,
8806
8832
  dist = _ref.dist,
8807
8833
  setCommitsOption = _ref.setCommitsOption,
@@ -8858,47 +8884,63 @@ function releaseManagementPlugin(_ref) {
8858
8884
  dist: dist
8859
8885
  });
8860
8886
  case 10:
8861
- if (!setCommitsOption) {
8862
- _context.next = 13;
8887
+ if (!(setCommitsOption !== false)) {
8888
+ _context.next = 23;
8863
8889
  break;
8864
8890
  }
8865
- _context.next = 13;
8891
+ _context.prev = 11;
8892
+ _context.next = 14;
8866
8893
  return cliInstance.releases.setCommits(releaseName, setCommitsOption);
8867
- case 13:
8894
+ case 14:
8895
+ _context.next = 23;
8896
+ break;
8897
+ case 16:
8898
+ _context.prev = 16;
8899
+ _context.t0 = _context["catch"](11);
8900
+ if (!("shouldNotThrowOnFailure" in setCommitsOption && setCommitsOption.shouldNotThrowOnFailure)) {
8901
+ _context.next = 22;
8902
+ break;
8903
+ }
8904
+ logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context.t0);
8905
+ _context.next = 23;
8906
+ break;
8907
+ case 22:
8908
+ throw _context.t0;
8909
+ case 23:
8868
8910
  if (!shouldFinalizeRelease) {
8869
- _context.next = 16;
8911
+ _context.next = 26;
8870
8912
  break;
8871
8913
  }
8872
- _context.next = 16;
8914
+ _context.next = 26;
8873
8915
  return cliInstance.releases.finalize(releaseName);
8874
- case 16:
8916
+ case 26:
8875
8917
  if (!deployOptions) {
8876
- _context.next = 19;
8918
+ _context.next = 29;
8877
8919
  break;
8878
8920
  }
8879
- _context.next = 19;
8921
+ _context.next = 29;
8880
8922
  return cliInstance.releases.newDeploy(releaseName, deployOptions);
8881
- case 19:
8882
- _context.next = 27;
8923
+ case 29:
8924
+ _context.next = 37;
8883
8925
  break;
8884
- case 21:
8885
- _context.prev = 21;
8886
- _context.t0 = _context["catch"](1);
8926
+ case 31:
8927
+ _context.prev = 31;
8928
+ _context.t1 = _context["catch"](1);
8887
8929
  sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
8888
- _context.next = 26;
8930
+ _context.next = 36;
8889
8931
  return safeFlushTelemetry(sentryClient);
8890
- case 26:
8891
- handleRecoverableError(_context.t0, false);
8892
- case 27:
8893
- _context.prev = 27;
8932
+ case 36:
8933
+ handleRecoverableError(_context.t1, false);
8934
+ case 37:
8935
+ _context.prev = 37;
8894
8936
  freeGlobalDependencyOnSourcemapFiles();
8895
8937
  freeWriteBundleInvocationDependencyOnSourcemapFiles();
8896
- return _context.finish(27);
8897
- case 31:
8938
+ return _context.finish(37);
8939
+ case 41:
8898
8940
  case "end":
8899
8941
  return _context.stop();
8900
8942
  }
8901
- }, _callee, null, [[1, 21, 27, 31]]);
8943
+ }, _callee, null, [[1, 31, 37, 41], [11, 16]]);
8902
8944
  }))();
8903
8945
  }
8904
8946
  };
@@ -9158,7 +9200,7 @@ function sentryUnpluginFactory(_ref) {
9158
9200
  });
9159
9201
 
9160
9202
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
9161
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.2");
9203
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.4");
9162
9204
 
9163
9205
  /**
9164
9206
  * Handles errors caught and emitted in various areas of the plugin.
@@ -9314,20 +9356,20 @@ function sentryUnpluginFactory(_ref) {
9314
9356
  plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
9315
9357
  }
9316
9358
  // https://turbo.build/repo/docs/reference/system-environment-variables#environment-variables-in-tasks
9317
- var isRunningInTurboRepo = Boolean(process.env["TURBO_HASH"]);
9318
- var getTruboRepoEnvPassthroughWarning = function getTruboRepoEnvPassthroughWarning(envVarName) {
9319
- 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") : "";
9359
+ var isRunningInTurborepo = Boolean(process.env["TURBO_HASH"]);
9360
+ var getTurborepoEnvPassthroughWarning = function getTurborepoEnvPassthroughWarning(envVarName) {
9361
+ 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") : "";
9320
9362
  };
9321
9363
  if (!options.release.name) {
9322
9364
  logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
9323
9365
  } else if (isDevMode) {
9324
9366
  logger.debug("Running in development mode. Will not create release.");
9325
9367
  } else if (!options.authToken) {
9326
- 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"));
9368
+ 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"));
9327
9369
  } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
9328
- logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTruboRepoEnvPassthroughWarning("SENTRY_ORG"));
9370
+ logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
9329
9371
  } else if (!options.project) {
9330
- logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTruboRepoEnvPassthroughWarning("SENTRY_PROJECT"));
9372
+ logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
9331
9373
  } else {
9332
9374
  plugins.push(releaseManagementPlugin({
9333
9375
  logger: logger,
@@ -9335,6 +9377,8 @@ function sentryUnpluginFactory(_ref) {
9335
9377
  shouldCreateRelease: options.release.create,
9336
9378
  shouldFinalizeRelease: options.release.finalize,
9337
9379
  include: options.release.uploadLegacySourcemaps,
9380
+ // setCommits has a default defined by the options mappings
9381
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9338
9382
  setCommitsOption: options.release.setCommits,
9339
9383
  deployOptions: options.release.deploy,
9340
9384
  dist: options.release.dist,
@@ -9361,11 +9405,11 @@ function sentryUnpluginFactory(_ref) {
9361
9405
  } else if (isDevMode) {
9362
9406
  logger.debug("Running in development mode. Will not upload sourcemaps.");
9363
9407
  } else if (!options.authToken) {
9364
- 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"));
9408
+ 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"));
9365
9409
  } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
9366
- logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTruboRepoEnvPassthroughWarning("SENTRY_ORG"));
9410
+ logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
9367
9411
  } else if (!options.project) {
9368
- logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTruboRepoEnvPassthroughWarning("SENTRY_PROJECT"));
9412
+ logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
9369
9413
  } else {
9370
9414
  var _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5;
9371
9415
  // This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins