@sentry/bundler-plugin-core 2.4.0 → 2.5.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.
@@ -585,6 +585,13 @@ function generateGlobalInjectorCode(_ref2) {
585
585
  }
586
586
  return code;
587
587
  }
588
+
589
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
590
+ function generateModuleMetadataInjectorCode(metadata) {
591
+ // The code below is mostly ternary operators because it saves bundle size.
592
+ // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
593
+ return "\n var _global2 =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global2._sentryModuleMetadata = _global2._sentryModuleMetadata || {};\n _global2._sentryModuleMetadata[new Error().stack] = ".concat(JSON.stringify(metadata), ";");
594
+ }
588
595
  function getBuildInformation$1() {
589
596
  var packageJson = getPackageJson();
590
597
  var _ref3 = packageJson ? getDependencies(packageJson) : {
@@ -1259,7 +1266,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
1259
1266
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
1260
1267
  tracesSampleRate: 1,
1261
1268
  sampleRate: 1,
1262
- release: "2.4.0",
1269
+ release: "2.5.0",
1263
1270
  integrations: [],
1264
1271
  tracePropagationTargets: ["sentry.io/api"],
1265
1272
  stackParser: defaultStackParser,
@@ -1445,6 +1452,7 @@ function _allowedToSendTelemetry() {
1445
1452
  */
1446
1453
  function sentryUnpluginFactory(_ref) {
1447
1454
  var releaseInjectionPlugin = _ref.releaseInjectionPlugin,
1455
+ moduleMetadataInjectionPlugin = _ref.moduleMetadataInjectionPlugin,
1448
1456
  debugIdInjectionPlugin = _ref.debugIdInjectionPlugin,
1449
1457
  debugIdUploadPlugin = _ref.debugIdUploadPlugin;
1450
1458
  return createUnplugin(function (userOptions, unpluginMetaContext) {
@@ -1488,7 +1496,7 @@ function sentryUnpluginFactory(_ref) {
1488
1496
  });
1489
1497
 
1490
1498
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
1491
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.4.0");
1499
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.5.0");
1492
1500
  function handleRecoverableError(unknownError) {
1493
1501
  sentrySession.status = "abnormal";
1494
1502
  try {
@@ -1527,7 +1535,7 @@ function sentryUnpluginFactory(_ref) {
1527
1535
  if (!options.release.inject) {
1528
1536
  logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
1529
1537
  } else if (!options.release.name) {
1530
- logger.warn("No release name provided. Will not inject release. Please set the `release.name` option to identifiy your release.");
1538
+ logger.warn("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
1531
1539
  } else {
1532
1540
  var _injectionCode = generateGlobalInjectorCode({
1533
1541
  release: options.release.name,
@@ -1535,8 +1543,27 @@ function sentryUnpluginFactory(_ref) {
1535
1543
  });
1536
1544
  plugins.push(releaseInjectionPlugin(_injectionCode));
1537
1545
  }
1546
+ if (moduleMetadataInjectionPlugin && options._experiments.moduleMetadata) {
1547
+ var metadata;
1548
+ if (typeof options._experiments.moduleMetadata === "function") {
1549
+ var args = {
1550
+ org: options.org,
1551
+ project: options.project,
1552
+ release: options.release.name
1553
+ };
1554
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
1555
+ metadata = options._experiments.moduleMetadata(args);
1556
+ } else {
1557
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1558
+ metadata = options._experiments.moduleMetadata;
1559
+ }
1560
+ var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
1561
+ plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
1562
+ } else if (options._experiments.moduleMetadata) {
1563
+ logger.warn("'moduleMetadata' is currently only supported by '@sentry/webpack-plugin'");
1564
+ }
1538
1565
  if (!options.release.name) {
1539
- logger.warn("No release name provided. Will not create release. Please set the `release.name` option to identifiy your release.");
1566
+ logger.warn("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
1540
1567
  } else if (!options.authToken) {
1541
1568
  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/");
1542
1569
  } else if (!options.org) {