@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.
package/dist/cjs/index.js CHANGED
@@ -619,6 +619,13 @@ function generateGlobalInjectorCode(_ref2) {
619
619
  }
620
620
  return code;
621
621
  }
622
+
623
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
624
+ function generateModuleMetadataInjectorCode(metadata) {
625
+ // The code below is mostly ternary operators because it saves bundle size.
626
+ // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
627
+ 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), ";");
628
+ }
622
629
  function getBuildInformation$1() {
623
630
  var packageJson = getPackageJson();
624
631
  var _ref3 = packageJson ? getDependencies(packageJson) : {
@@ -1293,7 +1300,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
1293
1300
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
1294
1301
  tracesSampleRate: 1,
1295
1302
  sampleRate: 1,
1296
- release: "2.4.0",
1303
+ release: "2.5.0",
1297
1304
  integrations: [],
1298
1305
  tracePropagationTargets: ["sentry.io/api"],
1299
1306
  stackParser: node.defaultStackParser,
@@ -1479,6 +1486,7 @@ function _allowedToSendTelemetry() {
1479
1486
  */
1480
1487
  function sentryUnpluginFactory(_ref) {
1481
1488
  var releaseInjectionPlugin = _ref.releaseInjectionPlugin,
1489
+ moduleMetadataInjectionPlugin = _ref.moduleMetadataInjectionPlugin,
1482
1490
  debugIdInjectionPlugin = _ref.debugIdInjectionPlugin,
1483
1491
  debugIdUploadPlugin = _ref.debugIdUploadPlugin;
1484
1492
  return unplugin.createUnplugin(function (userOptions, unpluginMetaContext) {
@@ -1522,7 +1530,7 @@ function sentryUnpluginFactory(_ref) {
1522
1530
  });
1523
1531
 
1524
1532
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
1525
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.4.0");
1533
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.5.0");
1526
1534
  function handleRecoverableError(unknownError) {
1527
1535
  sentrySession.status = "abnormal";
1528
1536
  try {
@@ -1561,7 +1569,7 @@ function sentryUnpluginFactory(_ref) {
1561
1569
  if (!options.release.inject) {
1562
1570
  logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
1563
1571
  } else if (!options.release.name) {
1564
- logger.warn("No release name provided. Will not inject release. Please set the `release.name` option to identifiy your release.");
1572
+ logger.warn("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
1565
1573
  } else {
1566
1574
  var _injectionCode = generateGlobalInjectorCode({
1567
1575
  release: options.release.name,
@@ -1569,8 +1577,27 @@ function sentryUnpluginFactory(_ref) {
1569
1577
  });
1570
1578
  plugins.push(releaseInjectionPlugin(_injectionCode));
1571
1579
  }
1580
+ if (moduleMetadataInjectionPlugin && options._experiments.moduleMetadata) {
1581
+ var metadata;
1582
+ if (typeof options._experiments.moduleMetadata === "function") {
1583
+ var args = {
1584
+ org: options.org,
1585
+ project: options.project,
1586
+ release: options.release.name
1587
+ };
1588
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
1589
+ metadata = options._experiments.moduleMetadata(args);
1590
+ } else {
1591
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1592
+ metadata = options._experiments.moduleMetadata;
1593
+ }
1594
+ var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
1595
+ plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
1596
+ } else if (options._experiments.moduleMetadata) {
1597
+ logger.warn("'moduleMetadata' is currently only supported by '@sentry/webpack-plugin'");
1598
+ }
1572
1599
  if (!options.release.name) {
1573
- logger.warn("No release name provided. Will not create release. Please set the `release.name` option to identifiy your release.");
1600
+ logger.warn("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
1574
1601
  } else if (!options.authToken) {
1575
1602
  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/");
1576
1603
  } else if (!options.org) {