@sentry/bundler-plugin-core 2.22.7 → 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
@@ -647,6 +647,8 @@ function determineReleaseName() {
647
647
  process.env["HEROKU_TEST_RUN_COMMIT_VERSION"] ||
648
648
  // Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases
649
649
  process.env["HEROKU_SLUG_COMMIT"] ||
650
+ // Railway - https://docs.railway.app/reference/variables#git-variables
651
+ process.env["RAILWAY_GIT_COMMIT_SHA"] ||
650
652
  // Render - https://render.com/docs/environment-variables
651
653
  process.env["RENDER_GIT_COMMIT"] ||
652
654
  // Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables
@@ -684,11 +686,12 @@ function generateGlobalInjectorCode(_ref2) {
684
686
  injectBuildInformation = _ref2.injectBuildInformation;
685
687
  // The code below is mostly ternary operators because it saves bundle size.
686
688
  // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
687
- var code = "\n var _global =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\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), "};");
688
690
  if (injectBuildInformation) {
689
691
  var buildInfo = getBuildInformation$1();
690
692
  code += "\n _global.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
691
693
  }
694
+ code += "}";
692
695
  return code;
693
696
  }
694
697
 
@@ -697,7 +700,7 @@ function generateModuleMetadataInjectorCode(metadata) {
697
700
  // The code below is mostly ternary operators because it saves bundle size.
698
701
  // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
699
702
  // We are merging the metadata objects in case modules are bundled twice with the plugin
700
- return "{\n var _sentryModuleMetadataGlobal =\n typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\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}");
701
704
  }
702
705
  function getBuildInformation$1() {
703
706
  var packageJson = getPackageJson();
@@ -738,7 +741,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
738
741
 
739
742
  var SENTRY_SAAS_URL = "https://sentry.io";
740
743
  function normalizeUserOptions(userOptions) {
741
- 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;
742
745
  var options = {
743
746
  org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
744
747
  project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
@@ -766,8 +769,8 @@ function normalizeUserOptions(userOptions) {
766
769
  }
767
770
  },
768
771
  applicationKey: userOptions.applicationKey,
769
- moduleMetadata: userOptions.moduleMetadata || ((_userOptions$_experim = userOptions._experiments) === null || _userOptions$_experim === void 0 ? void 0 : _userOptions$_experim.moduleMetadata),
770
- _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 : {}
771
774
  };
772
775
  return options;
773
776
  }
@@ -8108,7 +8111,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
8108
8111
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8109
8112
  tracesSampleRate: 1,
8110
8113
  sampleRate: 1,
8111
- release: "2.22.7",
8114
+ release: "3.0.0",
8112
8115
  integrations: [],
8113
8116
  tracePropagationTargets: ["sentry.io/api"],
8114
8117
  stackParser: stackParser,
@@ -8165,7 +8168,7 @@ function setTelemetryDataOnScope(options, scope, bundler) {
8165
8168
  // Miscellaneous options
8166
8169
  scope.setTag("custom-error-handler", !!errorHandler);
8167
8170
  scope.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
8168
- 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));
8169
8172
  scope.setTag("sourcemaps-disabled", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.disable));
8170
8173
  scope.setTag("react-annotate", !!(reactComponentAnnotation !== null && reactComponentAnnotation !== void 0 && reactComponentAnnotation.enabled));
8171
8174
  scope.setTag("node", process.version);
@@ -8792,6 +8795,11 @@ function defaultRewriteSourcesHook(source) {
8792
8795
  }
8793
8796
  }
8794
8797
 
8798
+ /**
8799
+ * Creates a plugin that creates releases, sets commits, deploys and finalizes releases.
8800
+ *
8801
+ * Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
8802
+ */
8795
8803
  function releaseManagementPlugin(_ref) {
8796
8804
  var releaseName = _ref.releaseName,
8797
8805
  include = _ref.include,
@@ -8807,7 +8815,7 @@ function releaseManagementPlugin(_ref) {
8807
8815
  createDependencyOnSourcemapFiles = _ref.createDependencyOnSourcemapFiles;
8808
8816
  var freeGlobalDependencyOnSourcemapFiles = createDependencyOnSourcemapFiles();
8809
8817
  return {
8810
- name: "sentry-debug-id-upload-plugin",
8818
+ name: "sentry-release-management-plugin",
8811
8819
  writeBundle: function writeBundle() {
8812
8820
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8813
8821
  var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, normalizedInclude;
@@ -8944,7 +8952,7 @@ function createLogger(options) {
8944
8952
  params[_key - 1] = arguments[_key];
8945
8953
  }
8946
8954
  // eslint-disable-next-line no-console
8947
- (_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));
8948
8956
  }
8949
8957
  },
8950
8958
  warn: function warn(message) {
@@ -8954,7 +8962,7 @@ function createLogger(options) {
8954
8962
  params[_key2 - 1] = arguments[_key2];
8955
8963
  }
8956
8964
  // eslint-disable-next-line no-console
8957
- (_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));
8958
8966
  }
8959
8967
  },
8960
8968
  error: function error(message) {
@@ -8974,7 +8982,7 @@ function createLogger(options) {
8974
8982
  params[_key4 - 1] = arguments[_key4];
8975
8983
  }
8976
8984
  // eslint-disable-next-line no-console
8977
- (_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));
8978
8986
  }
8979
8987
  }
8980
8988
  };
@@ -9078,7 +9086,7 @@ function sentryUnpluginFactory(_ref) {
9078
9086
  debugIdUploadPlugin = _ref.debugIdUploadPlugin,
9079
9087
  bundleSizeOptimizationsPlugin = _ref.bundleSizeOptimizationsPlugin;
9080
9088
  return unplugin.createUnplugin(function () {
9081
- 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;
9082
9090
  var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9083
9091
  var unpluginMetaContext = arguments.length > 1 ? arguments[1] : undefined;
9084
9092
  var logger = createLogger({
@@ -9102,11 +9110,6 @@ function sentryUnpluginFactory(_ref) {
9102
9110
  }
9103
9111
  }
9104
9112
  var options = normalizeUserOptions(userOptions);
9105
-
9106
- // TODO(v3): Remove this warning
9107
- if ((_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 && _userOptions$_experim.moduleMetadata) {
9108
- logger.warn("The `_experiments.moduleMetadata` option has been promoted to being stable. You can safely move the option out of the `_experiments` object scope.");
9109
- }
9110
9113
  if (unpluginMetaContext.watchMode || options.disable) {
9111
9114
  return [{
9112
9115
  name: "sentry-noop-plugin"
@@ -9144,7 +9147,7 @@ function sentryUnpluginFactory(_ref) {
9144
9147
  });
9145
9148
 
9146
9149
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
9147
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.22.7");
9150
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.0.0");
9148
9151
  function handleRecoverableError(unknownError) {
9149
9152
  sentrySession.status = "abnormal";
9150
9153
  try {
@@ -9227,8 +9230,8 @@ function sentryUnpluginFactory(_ref) {
9227
9230
  if (bundleSizeOptimizations.excludeDebugStatements) {
9228
9231
  replacementValues["__SENTRY_DEBUG__"] = false;
9229
9232
  }
9230
- if (bundleSizeOptimizations.excludePerformanceMonitoring || bundleSizeOptimizations.excludeTracing) {
9231
- replacementValues["__SENTRY_TRACE__"] = false;
9233
+ if (bundleSizeOptimizations.excludeTracing) {
9234
+ replacementValues["__SENTRY_TRACING__"] = false;
9232
9235
  }
9233
9236
  if (bundleSizeOptimizations.excludeReplayCanvas) {
9234
9237
  replacementValues["__RRWEB_EXCLUDE_CANVAS__"] = true;
@@ -9349,7 +9352,7 @@ function sentryUnpluginFactory(_ref) {
9349
9352
  vcsRemote: options.release.vcsRemote,
9350
9353
  headers: options.headers
9351
9354
  }
9352
- })));
9355
+ }), logger));
9353
9356
  }
9354
9357
  if (options.reactComponentAnnotation) {
9355
9358
  if (!options.reactComponentAnnotation.enabled) {
@@ -9357,12 +9360,12 @@ function sentryUnpluginFactory(_ref) {
9357
9360
  } else if (options.reactComponentAnnotation.enabled && !componentNameAnnotatePlugin) {
9358
9361
  logger.warn("The component name annotate plugin is currently not supported by '@sentry/esbuild-plugin'");
9359
9362
  } else {
9360
- componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin());
9363
+ componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin(options.reactComponentAnnotation.ignoredComponents));
9361
9364
  }
9362
9365
  }
9363
9366
  plugins.push(fileDeletionPlugin({
9364
9367
  waitUntilSourcemapFileDependenciesAreFreed: waitUntilSourcemapFileDependenciesAreFreed,
9365
- 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,
9366
9369
  logger: logger,
9367
9370
  handleRecoverableError: handleRecoverableError,
9368
9371
  sentryScope: sentryScope,
@@ -9586,7 +9589,7 @@ function createRollupDebugIdUploadHooks(upload) {
9586
9589
  }
9587
9590
  };
9588
9591
  }
9589
- function createComponentNameAnnotateHooks() {
9592
+ function createComponentNameAnnotateHooks(ignoredComponents) {
9590
9593
  return {
9591
9594
  transform: function transform(code, id) {
9592
9595
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
@@ -9619,7 +9622,9 @@ function createComponentNameAnnotateHooks() {
9619
9622
  _context2.prev = 7;
9620
9623
  _context2.next = 10;
9621
9624
  return core.transformAsync(code, {
9622
- plugins: [[componentNameAnnotatePlugin__default["default"]]],
9625
+ plugins: [[componentNameAnnotatePlugin__default["default"], {
9626
+ ignoredComponents: ignoredComponents
9627
+ }]],
9623
9628
  filename: id,
9624
9629
  parserOpts: {
9625
9630
  sourceType: "module",
@@ -9655,7 +9660,7 @@ function createComponentNameAnnotateHooks() {
9655
9660
  };
9656
9661
  }
9657
9662
  function getDebugIdSnippet(debugId) {
9658
- return ";!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"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){}};");
9659
9664
  }
9660
9665
 
9661
9666
  exports.createComponentNameAnnotateHooks = createComponentNameAnnotateHooks;