@sentry/bundler-plugin-core 2.23.0 → 3.0.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
@@ -686,11 +686,12 @@ function generateGlobalInjectorCode(_ref2) {
686
686
  injectBuildInformation = _ref2.injectBuildInformation;
687
687
  // The code below is mostly ternary operators because it saves bundle size.
688
688
  // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
689
- var code = "\n var _global =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof globalThis !== 'undefined' ?\n globalThis :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global.SENTRY_RELEASE={id:".concat(JSON.stringify(release), "};");
689
+ var code = "{\n let _global =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof globalThis !== 'undefined' ?\n globalThis :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global.SENTRY_RELEASE={id:".concat(JSON.stringify(release), "};");
690
690
  if (injectBuildInformation) {
691
691
  var buildInfo = getBuildInformation$1();
692
692
  code += "\n _global.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
693
693
  }
694
+ code += "}";
694
695
  return code;
695
696
  }
696
697
 
@@ -699,7 +700,7 @@ function generateModuleMetadataInjectorCode(metadata) {
699
700
  // The code below is mostly ternary operators because it saves bundle size.
700
701
  // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
701
702
  // We are merging the metadata objects in case modules are bundled twice with the plugin
702
- return "{\n var _sentryModuleMetadataGlobal =\n typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata =\n _sentryModuleMetadataGlobal._sentryModuleMetadata || {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack] =\n Object.assign(\n {},\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack],\n ".concat(JSON.stringify(metadata), "\n );\n}");
703
+ return "{\n let _sentryModuleMetadataGlobal =\n typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata =\n _sentryModuleMetadataGlobal._sentryModuleMetadata || {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack] =\n Object.assign(\n {},\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack],\n ".concat(JSON.stringify(metadata), "\n );\n}");
703
704
  }
704
705
  function getBuildInformation$1() {
705
706
  var packageJson = getPackageJson();
@@ -740,7 +741,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
740
741
 
741
742
  var SENTRY_SAAS_URL = "https://sentry.io";
742
743
  function normalizeUserOptions(userOptions) {
743
- 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, _userOptions$_experim2;
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
745
  var options = {
745
746
  org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
746
747
  project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
@@ -768,8 +769,8 @@ function normalizeUserOptions(userOptions) {
768
769
  }
769
770
  },
770
771
  applicationKey: userOptions.applicationKey,
771
- moduleMetadata: userOptions.moduleMetadata || ((_userOptions$_experim = userOptions._experiments) === null || _userOptions$_experim === void 0 ? void 0 : _userOptions$_experim.moduleMetadata),
772
- _experiments: (_userOptions$_experim2 = userOptions._experiments) !== null && _userOptions$_experim2 !== void 0 ? _userOptions$_experim2 : {}
772
+ moduleMetadata: userOptions.moduleMetadata,
773
+ _experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
773
774
  };
774
775
  return options;
775
776
  }
@@ -8110,7 +8111,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
8110
8111
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8111
8112
  tracesSampleRate: 1,
8112
8113
  sampleRate: 1,
8113
- release: "2.23.0",
8114
+ release: "3.0.0",
8114
8115
  integrations: [],
8115
8116
  tracePropagationTargets: ["sentry.io/api"],
8116
8117
  stackParser: stackParser,
@@ -8167,7 +8168,7 @@ function setTelemetryDataOnScope(options, scope, bundler) {
8167
8168
  // Miscellaneous options
8168
8169
  scope.setTag("custom-error-handler", !!errorHandler);
8169
8170
  scope.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
8170
- scope.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
8171
+ scope.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
8171
8172
  scope.setTag("sourcemaps-disabled", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.disable));
8172
8173
  scope.setTag("react-annotate", !!(reactComponentAnnotation !== null && reactComponentAnnotation !== void 0 && reactComponentAnnotation.enabled));
8173
8174
  scope.setTag("node", process.version);
@@ -8951,7 +8952,7 @@ function createLogger(options) {
8951
8952
  params[_key - 1] = arguments[_key];
8952
8953
  }
8953
8954
  // eslint-disable-next-line no-console
8954
- (_console = console).error.apply(_console, ["".concat(options.prefix, " Info: ").concat(message)].concat(params));
8955
+ (_console = console).info.apply(_console, ["".concat(options.prefix, " Info: ").concat(message)].concat(params));
8955
8956
  }
8956
8957
  },
8957
8958
  warn: function warn(message) {
@@ -8961,7 +8962,7 @@ function createLogger(options) {
8961
8962
  params[_key2 - 1] = arguments[_key2];
8962
8963
  }
8963
8964
  // eslint-disable-next-line no-console
8964
- (_console2 = console).error.apply(_console2, ["".concat(options.prefix, " Warning: ").concat(message)].concat(params));
8965
+ (_console2 = console).warn.apply(_console2, ["".concat(options.prefix, " Warning: ").concat(message)].concat(params));
8965
8966
  }
8966
8967
  },
8967
8968
  error: function error(message) {
@@ -8981,7 +8982,7 @@ function createLogger(options) {
8981
8982
  params[_key4 - 1] = arguments[_key4];
8982
8983
  }
8983
8984
  // eslint-disable-next-line no-console
8984
- (_console4 = console).error.apply(_console4, ["".concat(options.prefix, " Debug: ").concat(message)].concat(params));
8985
+ (_console4 = console).debug.apply(_console4, ["".concat(options.prefix, " Debug: ").concat(message)].concat(params));
8985
8986
  }
8986
8987
  }
8987
8988
  };
@@ -9085,7 +9086,7 @@ function sentryUnpluginFactory(_ref) {
9085
9086
  debugIdUploadPlugin = _ref.debugIdUploadPlugin,
9086
9087
  bundleSizeOptimizationsPlugin = _ref.bundleSizeOptimizationsPlugin;
9087
9088
  return unplugin.createUnplugin(function () {
9088
- var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug, _userOptions$_experim, _options$sourcemaps, _options$sourcemaps2, _options$sourcemaps$f, _options$sourcemaps6, _options$sourcemaps7;
9089
+ var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug, _options$sourcemaps, _options$sourcemaps2, _options$sourcemaps6;
9089
9090
  var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9090
9091
  var unpluginMetaContext = arguments.length > 1 ? arguments[1] : undefined;
9091
9092
  var logger = createLogger({
@@ -9109,11 +9110,6 @@ function sentryUnpluginFactory(_ref) {
9109
9110
  }
9110
9111
  }
9111
9112
  var options = normalizeUserOptions(userOptions);
9112
-
9113
- // TODO(v3): Remove this warning
9114
- if ((_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 && _userOptions$_experim.moduleMetadata) {
9115
- logger.warn("The `_experiments.moduleMetadata` option has been promoted to being stable. You can safely move the option out of the `_experiments` object scope.");
9116
- }
9117
9113
  if (unpluginMetaContext.watchMode || options.disable) {
9118
9114
  return [{
9119
9115
  name: "sentry-noop-plugin"
@@ -9151,7 +9147,7 @@ function sentryUnpluginFactory(_ref) {
9151
9147
  });
9152
9148
 
9153
9149
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
9154
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.23.0");
9150
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.0.0");
9155
9151
  function handleRecoverableError(unknownError) {
9156
9152
  sentrySession.status = "abnormal";
9157
9153
  try {
@@ -9234,8 +9230,8 @@ function sentryUnpluginFactory(_ref) {
9234
9230
  if (bundleSizeOptimizations.excludeDebugStatements) {
9235
9231
  replacementValues["__SENTRY_DEBUG__"] = false;
9236
9232
  }
9237
- if (bundleSizeOptimizations.excludePerformanceMonitoring || bundleSizeOptimizations.excludeTracing) {
9238
- replacementValues["__SENTRY_TRACE__"] = false;
9233
+ if (bundleSizeOptimizations.excludeTracing) {
9234
+ replacementValues["__SENTRY_TRACING__"] = false;
9239
9235
  }
9240
9236
  if (bundleSizeOptimizations.excludeReplayCanvas) {
9241
9237
  replacementValues["__RRWEB_EXCLUDE_CANVAS__"] = true;
@@ -9356,7 +9352,7 @@ function sentryUnpluginFactory(_ref) {
9356
9352
  vcsRemote: options.release.vcsRemote,
9357
9353
  headers: options.headers
9358
9354
  }
9359
- })));
9355
+ }), logger));
9360
9356
  }
9361
9357
  if (options.reactComponentAnnotation) {
9362
9358
  if (!options.reactComponentAnnotation.enabled) {
@@ -9369,7 +9365,7 @@ function sentryUnpluginFactory(_ref) {
9369
9365
  }
9370
9366
  plugins.push(fileDeletionPlugin({
9371
9367
  waitUntilSourcemapFileDependenciesAreFreed: waitUntilSourcemapFileDependenciesAreFreed,
9372
- filesToDeleteAfterUpload: (_options$sourcemaps$f = (_options$sourcemaps6 = options.sourcemaps) === null || _options$sourcemaps6 === void 0 ? void 0 : _options$sourcemaps6.filesToDeleteAfterUpload) !== null && _options$sourcemaps$f !== void 0 ? _options$sourcemaps$f : (_options$sourcemaps7 = options.sourcemaps) === null || _options$sourcemaps7 === void 0 ? void 0 : _options$sourcemaps7.deleteFilesAfterUpload,
9368
+ filesToDeleteAfterUpload: (_options$sourcemaps6 = options.sourcemaps) === null || _options$sourcemaps6 === void 0 ? void 0 : _options$sourcemaps6.filesToDeleteAfterUpload,
9373
9369
  logger: logger,
9374
9370
  handleRecoverableError: handleRecoverableError,
9375
9371
  sentryScope: sentryScope,
@@ -9664,7 +9660,7 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
9664
9660
  };
9665
9661
  }
9666
9662
  function getDebugIdSnippet(debugId) {
9667
- return ";!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"".concat(debugId, "\",e._sentryDebugIdIdentifier=\"sentry-dbid-").concat(debugId, "\")}catch(e){}}();");
9663
+ return ";{try{let e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"".concat(debugId, "\",e._sentryDebugIdIdentifier=\"sentry-dbid-").concat(debugId, "\")}catch(e){}};");
9668
9664
  }
9669
9665
 
9670
9666
  exports.createComponentNameAnnotateHooks = createComponentNameAnnotateHooks;