@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.
@@ -611,6 +611,8 @@ function determineReleaseName() {
611
611
  process.env["HEROKU_TEST_RUN_COMMIT_VERSION"] ||
612
612
  // Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases
613
613
  process.env["HEROKU_SLUG_COMMIT"] ||
614
+ // Railway - https://docs.railway.app/reference/variables#git-variables
615
+ process.env["RAILWAY_GIT_COMMIT_SHA"] ||
614
616
  // Render - https://render.com/docs/environment-variables
615
617
  process.env["RENDER_GIT_COMMIT"] ||
616
618
  // Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables
@@ -648,11 +650,12 @@ function generateGlobalInjectorCode(_ref2) {
648
650
  injectBuildInformation = _ref2.injectBuildInformation;
649
651
  // The code below is mostly ternary operators because it saves bundle size.
650
652
  // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
651
- 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), "};");
653
+ 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), "};");
652
654
  if (injectBuildInformation) {
653
655
  var buildInfo = getBuildInformation$1();
654
656
  code += "\n _global.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
655
657
  }
658
+ code += "}";
656
659
  return code;
657
660
  }
658
661
 
@@ -661,7 +664,7 @@ function generateModuleMetadataInjectorCode(metadata) {
661
664
  // The code below is mostly ternary operators because it saves bundle size.
662
665
  // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
663
666
  // We are merging the metadata objects in case modules are bundled twice with the plugin
664
- 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}");
667
+ 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}");
665
668
  }
666
669
  function getBuildInformation$1() {
667
670
  var packageJson = getPackageJson();
@@ -702,7 +705,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
702
705
 
703
706
  var SENTRY_SAAS_URL = "https://sentry.io";
704
707
  function normalizeUserOptions(userOptions) {
705
- 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;
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;
706
709
  var options = {
707
710
  org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
708
711
  project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
@@ -730,8 +733,8 @@ function normalizeUserOptions(userOptions) {
730
733
  }
731
734
  },
732
735
  applicationKey: userOptions.applicationKey,
733
- moduleMetadata: userOptions.moduleMetadata || ((_userOptions$_experim = userOptions._experiments) === null || _userOptions$_experim === void 0 ? void 0 : _userOptions$_experim.moduleMetadata),
734
- _experiments: (_userOptions$_experim2 = userOptions._experiments) !== null && _userOptions$_experim2 !== void 0 ? _userOptions$_experim2 : {}
736
+ moduleMetadata: userOptions.moduleMetadata,
737
+ _experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
735
738
  };
736
739
  return options;
737
740
  }
@@ -8072,7 +8075,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
8072
8075
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8073
8076
  tracesSampleRate: 1,
8074
8077
  sampleRate: 1,
8075
- release: "2.22.7",
8078
+ release: "3.0.0",
8076
8079
  integrations: [],
8077
8080
  tracePropagationTargets: ["sentry.io/api"],
8078
8081
  stackParser: stackParser,
@@ -8129,7 +8132,7 @@ function setTelemetryDataOnScope(options, scope, bundler) {
8129
8132
  // Miscellaneous options
8130
8133
  scope.setTag("custom-error-handler", !!errorHandler);
8131
8134
  scope.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
8132
- scope.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
8135
+ scope.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
8133
8136
  scope.setTag("sourcemaps-disabled", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.disable));
8134
8137
  scope.setTag("react-annotate", !!(reactComponentAnnotation !== null && reactComponentAnnotation !== void 0 && reactComponentAnnotation.enabled));
8135
8138
  scope.setTag("node", process.version);
@@ -8756,6 +8759,11 @@ function defaultRewriteSourcesHook(source) {
8756
8759
  }
8757
8760
  }
8758
8761
 
8762
+ /**
8763
+ * Creates a plugin that creates releases, sets commits, deploys and finalizes releases.
8764
+ *
8765
+ * Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
8766
+ */
8759
8767
  function releaseManagementPlugin(_ref) {
8760
8768
  var releaseName = _ref.releaseName,
8761
8769
  include = _ref.include,
@@ -8771,7 +8779,7 @@ function releaseManagementPlugin(_ref) {
8771
8779
  createDependencyOnSourcemapFiles = _ref.createDependencyOnSourcemapFiles;
8772
8780
  var freeGlobalDependencyOnSourcemapFiles = createDependencyOnSourcemapFiles();
8773
8781
  return {
8774
- name: "sentry-debug-id-upload-plugin",
8782
+ name: "sentry-release-management-plugin",
8775
8783
  writeBundle: function writeBundle() {
8776
8784
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8777
8785
  var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, normalizedInclude;
@@ -8908,7 +8916,7 @@ function createLogger(options) {
8908
8916
  params[_key - 1] = arguments[_key];
8909
8917
  }
8910
8918
  // eslint-disable-next-line no-console
8911
- (_console = console).error.apply(_console, ["".concat(options.prefix, " Info: ").concat(message)].concat(params));
8919
+ (_console = console).info.apply(_console, ["".concat(options.prefix, " Info: ").concat(message)].concat(params));
8912
8920
  }
8913
8921
  },
8914
8922
  warn: function warn(message) {
@@ -8918,7 +8926,7 @@ function createLogger(options) {
8918
8926
  params[_key2 - 1] = arguments[_key2];
8919
8927
  }
8920
8928
  // eslint-disable-next-line no-console
8921
- (_console2 = console).error.apply(_console2, ["".concat(options.prefix, " Warning: ").concat(message)].concat(params));
8929
+ (_console2 = console).warn.apply(_console2, ["".concat(options.prefix, " Warning: ").concat(message)].concat(params));
8922
8930
  }
8923
8931
  },
8924
8932
  error: function error(message) {
@@ -8938,7 +8946,7 @@ function createLogger(options) {
8938
8946
  params[_key4 - 1] = arguments[_key4];
8939
8947
  }
8940
8948
  // eslint-disable-next-line no-console
8941
- (_console4 = console).error.apply(_console4, ["".concat(options.prefix, " Debug: ").concat(message)].concat(params));
8949
+ (_console4 = console).debug.apply(_console4, ["".concat(options.prefix, " Debug: ").concat(message)].concat(params));
8942
8950
  }
8943
8951
  }
8944
8952
  };
@@ -9042,7 +9050,7 @@ function sentryUnpluginFactory(_ref) {
9042
9050
  debugIdUploadPlugin = _ref.debugIdUploadPlugin,
9043
9051
  bundleSizeOptimizationsPlugin = _ref.bundleSizeOptimizationsPlugin;
9044
9052
  return createUnplugin(function () {
9045
- var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug, _userOptions$_experim, _options$sourcemaps, _options$sourcemaps2, _options$sourcemaps$f, _options$sourcemaps6, _options$sourcemaps7;
9053
+ var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug, _options$sourcemaps, _options$sourcemaps2, _options$sourcemaps6;
9046
9054
  var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9047
9055
  var unpluginMetaContext = arguments.length > 1 ? arguments[1] : undefined;
9048
9056
  var logger = createLogger({
@@ -9066,11 +9074,6 @@ function sentryUnpluginFactory(_ref) {
9066
9074
  }
9067
9075
  }
9068
9076
  var options = normalizeUserOptions(userOptions);
9069
-
9070
- // TODO(v3): Remove this warning
9071
- if ((_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 && _userOptions$_experim.moduleMetadata) {
9072
- logger.warn("The `_experiments.moduleMetadata` option has been promoted to being stable. You can safely move the option out of the `_experiments` object scope.");
9073
- }
9074
9077
  if (unpluginMetaContext.watchMode || options.disable) {
9075
9078
  return [{
9076
9079
  name: "sentry-noop-plugin"
@@ -9108,7 +9111,7 @@ function sentryUnpluginFactory(_ref) {
9108
9111
  });
9109
9112
 
9110
9113
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
9111
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.22.7");
9114
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.0.0");
9112
9115
  function handleRecoverableError(unknownError) {
9113
9116
  sentrySession.status = "abnormal";
9114
9117
  try {
@@ -9191,8 +9194,8 @@ function sentryUnpluginFactory(_ref) {
9191
9194
  if (bundleSizeOptimizations.excludeDebugStatements) {
9192
9195
  replacementValues["__SENTRY_DEBUG__"] = false;
9193
9196
  }
9194
- if (bundleSizeOptimizations.excludePerformanceMonitoring || bundleSizeOptimizations.excludeTracing) {
9195
- replacementValues["__SENTRY_TRACE__"] = false;
9197
+ if (bundleSizeOptimizations.excludeTracing) {
9198
+ replacementValues["__SENTRY_TRACING__"] = false;
9196
9199
  }
9197
9200
  if (bundleSizeOptimizations.excludeReplayCanvas) {
9198
9201
  replacementValues["__RRWEB_EXCLUDE_CANVAS__"] = true;
@@ -9313,7 +9316,7 @@ function sentryUnpluginFactory(_ref) {
9313
9316
  vcsRemote: options.release.vcsRemote,
9314
9317
  headers: options.headers
9315
9318
  }
9316
- })));
9319
+ }), logger));
9317
9320
  }
9318
9321
  if (options.reactComponentAnnotation) {
9319
9322
  if (!options.reactComponentAnnotation.enabled) {
@@ -9321,12 +9324,12 @@ function sentryUnpluginFactory(_ref) {
9321
9324
  } else if (options.reactComponentAnnotation.enabled && !componentNameAnnotatePlugin) {
9322
9325
  logger.warn("The component name annotate plugin is currently not supported by '@sentry/esbuild-plugin'");
9323
9326
  } else {
9324
- componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin());
9327
+ componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin(options.reactComponentAnnotation.ignoredComponents));
9325
9328
  }
9326
9329
  }
9327
9330
  plugins.push(fileDeletionPlugin({
9328
9331
  waitUntilSourcemapFileDependenciesAreFreed: waitUntilSourcemapFileDependenciesAreFreed,
9329
- 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,
9332
+ filesToDeleteAfterUpload: (_options$sourcemaps6 = options.sourcemaps) === null || _options$sourcemaps6 === void 0 ? void 0 : _options$sourcemaps6.filesToDeleteAfterUpload,
9330
9333
  logger: logger,
9331
9334
  handleRecoverableError: handleRecoverableError,
9332
9335
  sentryScope: sentryScope,
@@ -9550,7 +9553,7 @@ function createRollupDebugIdUploadHooks(upload) {
9550
9553
  }
9551
9554
  };
9552
9555
  }
9553
- function createComponentNameAnnotateHooks() {
9556
+ function createComponentNameAnnotateHooks(ignoredComponents) {
9554
9557
  return {
9555
9558
  transform: function transform(code, id) {
9556
9559
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
@@ -9583,7 +9586,9 @@ function createComponentNameAnnotateHooks() {
9583
9586
  _context2.prev = 7;
9584
9587
  _context2.next = 10;
9585
9588
  return transformAsync(code, {
9586
- plugins: [[componentNameAnnotatePlugin]],
9589
+ plugins: [[componentNameAnnotatePlugin, {
9590
+ ignoredComponents: ignoredComponents
9591
+ }]],
9587
9592
  filename: id,
9588
9593
  parserOpts: {
9589
9594
  sourceType: "module",
@@ -9619,7 +9624,7 @@ function createComponentNameAnnotateHooks() {
9619
9624
  };
9620
9625
  }
9621
9626
  function getDebugIdSnippet(debugId) {
9622
- 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){}}();");
9627
+ 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){}};");
9623
9628
  }
9624
9629
 
9625
9630
  export { createComponentNameAnnotateHooks, createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };