@sentry/bundler-plugin-core 3.2.0 → 3.2.2

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.
@@ -8075,7 +8075,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
8075
8075
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8076
8076
  tracesSampleRate: 1,
8077
8077
  sampleRate: 1,
8078
- release: "3.2.0",
8078
+ release: "3.2.2",
8079
8079
  integrations: [],
8080
8080
  tracePropagationTargets: ["sentry.io/api"],
8081
8081
  stackParser: stackParser,
@@ -8443,7 +8443,7 @@ function createDebugIdUploadFunction(_ref) {
8443
8443
  }));
8444
8444
  _context5.next = 3;
8445
8445
  return cliInstance.releases.uploadSourceMaps(releaseName !== null && releaseName !== void 0 ? releaseName : "undefined",
8446
- // unfortunetly this needs a value for now but it will not matter since debug IDs overpower releases anyhow
8446
+ // unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
8447
8447
  {
8448
8448
  include: [{
8449
8449
  paths: [tmpUploadFolder],
@@ -8481,7 +8481,7 @@ function createDebugIdUploadFunction(_ref) {
8481
8481
  _context8.prev = 25;
8482
8482
  _context8.t0 = _context8["catch"](1);
8483
8483
  sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
8484
- handleRecoverableError(_context8.t0);
8484
+ handleRecoverableError(_context8.t0, false);
8485
8485
  case 29:
8486
8486
  _context8.prev = 29;
8487
8487
  if (folderToCleanUp) {
@@ -8852,7 +8852,7 @@ function releaseManagementPlugin(_ref) {
8852
8852
  _context.next = 26;
8853
8853
  return safeFlushTelemetry(sentryClient);
8854
8854
  case 26:
8855
- handleRecoverableError(_context.t0);
8855
+ handleRecoverableError(_context.t0, false);
8856
8856
  case 27:
8857
8857
  _context.prev = 27;
8858
8858
  freeGlobalDependencyOnSourcemapFiles();
@@ -9009,7 +9009,9 @@ function fileDeletionPlugin(_ref) {
9009
9009
  _context.next = 21;
9010
9010
  return safeFlushTelemetry(sentryClient);
9011
9011
  case 21:
9012
- handleRecoverableError(_context.t0);
9012
+ // We throw by default if we get here b/c not being able to delete
9013
+ // source maps could leak them to production
9014
+ handleRecoverableError(_context.t0, true);
9013
9015
  case 22:
9014
9016
  case "end":
9015
9017
  return _context.stop();
@@ -9120,8 +9122,18 @@ function sentryUnpluginFactory(_ref) {
9120
9122
  });
9121
9123
 
9122
9124
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
9123
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.0");
9124
- function handleRecoverableError(unknownError) {
9125
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.2");
9126
+
9127
+ /**
9128
+ * Handles errors caught and emitted in various areas of the plugin.
9129
+ *
9130
+ * Also sets the sentry session status according to the error handling.
9131
+ *
9132
+ * If users specify their custom `errorHandler` we'll leave the decision to throw
9133
+ * or continue up to them. By default, @param throwByDefault controls if the plugin
9134
+ * should throw an error (which causes a build fail in most bundlers) or continue.
9135
+ */
9136
+ function handleRecoverableError(unknownError, throwByDefault) {
9125
9137
  sentrySession.status = "abnormal";
9126
9138
  try {
9127
9139
  if (options.errorHandler) {
@@ -9136,15 +9148,21 @@ function sentryUnpluginFactory(_ref) {
9136
9148
  throw e;
9137
9149
  }
9138
9150
  } else {
9151
+ // setting the session to "crashed" b/c from a plugin perspective this run failed.
9152
+ // However, we're intentionally not rethrowing the error to avoid breaking the user build.
9139
9153
  sentrySession.status = "crashed";
9140
- throw unknownError;
9154
+ if (throwByDefault) {
9155
+ throw unknownError;
9156
+ }
9157
+ logger.error("An error occurred. Couldn't finish all operations:", unknownError);
9141
9158
  }
9142
9159
  } finally {
9143
9160
  endSession();
9144
9161
  }
9145
9162
  }
9146
9163
  if (!validateOptions(options, logger)) {
9147
- handleRecoverableError(new Error("Options were not set correctly. See output above for more details."));
9164
+ // Throwing by default to avoid a misconfigured plugin going unnoticed.
9165
+ handleRecoverableError(new Error("Options were not set correctly. See output above for more details."), true);
9148
9166
  }
9149
9167
  if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) {
9150
9168
  logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
@@ -9259,16 +9277,21 @@ function sentryUnpluginFactory(_ref) {
9259
9277
  var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
9260
9278
  plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
9261
9279
  }
9280
+ // 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") : "";
9284
+ };
9262
9285
  if (!options.release.name) {
9263
9286
  logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
9264
9287
  } else if (isDevMode) {
9265
9288
  logger.debug("Running in development mode. Will not create release.");
9266
9289
  } else if (!options.authToken) {
9267
- 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/");
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"));
9268
9291
  } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
9269
- logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug.");
9292
+ logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTruboRepoEnvPassthroughWarning("SENTRY_ORG"));
9270
9293
  } else if (!options.project) {
9271
- logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug.");
9294
+ logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTruboRepoEnvPassthroughWarning("SENTRY_PROJECT"));
9272
9295
  } else {
9273
9296
  plugins.push(releaseManagementPlugin({
9274
9297
  logger: logger,
@@ -9302,11 +9325,11 @@ function sentryUnpluginFactory(_ref) {
9302
9325
  } else if (isDevMode) {
9303
9326
  logger.debug("Running in development mode. Will not upload sourcemaps.");
9304
9327
  } else if (!options.authToken) {
9305
- 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/");
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"));
9306
9329
  } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
9307
- logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug.");
9330
+ logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTruboRepoEnvPassthroughWarning("SENTRY_ORG"));
9308
9331
  } else if (!options.project) {
9309
- logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug.");
9332
+ logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTruboRepoEnvPassthroughWarning("SENTRY_PROJECT"));
9310
9333
  } else {
9311
9334
  var _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5;
9312
9335
  // This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins