@sentry/bundler-plugin-core 3.2.3 → 3.2.4

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
@@ -8137,7 +8137,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
8137
8137
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8138
8138
  tracesSampleRate: 1,
8139
8139
  sampleRate: 1,
8140
- release: "3.2.3",
8140
+ release: "3.2.4",
8141
8141
  integrations: [],
8142
8142
  tracePropagationTargets: ["sentry.io/api"],
8143
8143
  stackParser: stackParser,
@@ -8511,8 +8511,7 @@ function createDebugIdUploadFunction(_ref) {
8511
8511
  paths: [tmpUploadFolder],
8512
8512
  rewrite: false,
8513
8513
  dist: dist
8514
- }],
8515
- useArtifactBundle: true
8514
+ }]
8516
8515
  });
8517
8516
  case 3:
8518
8517
  case "end":
@@ -8596,9 +8595,16 @@ function createDebugIdUploadFunction(_ref) {
8596
8595
  function prepareBundleForDebugIdUpload(_x4, _x5, _x6, _x7, _x8) {
8597
8596
  return _prepareBundleForDebugIdUpload.apply(this, arguments);
8598
8597
  }
8598
+
8599
+ /**
8600
+ * Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle
8601
+ * source and extracts the bundle's debug ID from it.
8602
+ *
8603
+ * The string pattern is injected via the debug ID injection snipped.
8604
+ */
8599
8605
  function _prepareBundleForDebugIdUpload() {
8600
8606
  _prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
8601
- var bundleContent, debugId, uniqueSourceFileUploadPath, writeSourceFilePromise, writeSourceMapFilePromise;
8607
+ var bundleContent, debugId, uniqueUploadName, writeSourceFilePromise, writeSourceMapFilePromise;
8602
8608
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
8603
8609
  while (1) switch (_context11.prev = _context11.next) {
8604
8610
  case 0:
@@ -8623,13 +8629,9 @@ function _prepareBundleForDebugIdUpload() {
8623
8629
  logger.debug("Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: ".concat(bundleFilePath));
8624
8630
  return _context11.abrupt("return");
8625
8631
  case 14:
8626
- uniqueSourceFileUploadPath = getUniqueUploadPath(uploadFolder, chunkIndex, bundleFilePath);
8632
+ uniqueUploadName = "".concat(debugId, "-").concat(chunkIndex);
8627
8633
  bundleContent += "\n//# debugId=".concat(debugId);
8628
- writeSourceFilePromise = fs__default["default"].promises.mkdir(path__default["default"].dirname(uniqueSourceFileUploadPath), {
8629
- recursive: true
8630
- }).then(function () {
8631
- return fs__default["default"].promises.writeFile(uniqueSourceFileUploadPath, bundleContent, "utf-8");
8632
- });
8634
+ writeSourceFilePromise = fs__default["default"].promises.writeFile(path__default["default"].join(uploadFolder, "".concat(uniqueUploadName, ".js")), bundleContent, "utf-8");
8633
8635
  writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
8634
8636
  var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(sourceMapPath) {
8635
8637
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
@@ -8640,7 +8642,7 @@ function _prepareBundleForDebugIdUpload() {
8640
8642
  break;
8641
8643
  }
8642
8644
  _context10.next = 3;
8643
- return prepareSourceMapForDebugIdUpload(sourceMapPath, getUniqueUploadPath(uploadFolder, chunkIndex, sourceMapPath), debugId, rewriteSourcesHook, logger);
8645
+ return prepareSourceMapForDebugIdUpload(sourceMapPath, path__default["default"].join(uploadFolder, "".concat(uniqueUploadName, ".js.map")), debugId, rewriteSourcesHook, logger);
8644
8646
  case 3:
8645
8647
  case "end":
8646
8648
  return _context10.stop();
@@ -8664,26 +8666,6 @@ function _prepareBundleForDebugIdUpload() {
8664
8666
  }));
8665
8667
  return _prepareBundleForDebugIdUpload.apply(this, arguments);
8666
8668
  }
8667
- function getUniqueUploadPath(uploadFolder, chunkIndex, filePath) {
8668
- return path__default["default"].join(uploadFolder, // We add a "chunk index" segment to the path that is a simple incrementing number to avoid name collisions.
8669
- // Name collisions can happen when files are located "outside" of the current working directory, at different levels but they share a subpath.
8670
- // Example:
8671
- // - CWD: /root/foo/cwd
8672
- // - File 1: /root/foo/index.js -> ../foo/index.js -> foo/index.js
8673
- // - File 2: /foo/index.js -> ../../foo/index.js -> foo/index.js
8674
- "".concat(chunkIndex), path__default["default"].normalize(path__default["default"].relative(process.cwd(), filePath).split(path__default["default"].sep)
8675
- // We filter out these "navigation" segments because a) they look ugly b) they will cause us to break out of the upload folder.
8676
- .filter(function (segment) {
8677
- return segment !== ".." && segment !== ".";
8678
- }).join(path__default["default"].sep)));
8679
- }
8680
-
8681
- /**
8682
- * Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle
8683
- * source and extracts the bundle's debug ID from it.
8684
- *
8685
- * The string pattern is injected via the debug ID injection snipped.
8686
- */
8687
8669
  function determineDebugIdFromBundleSource(code) {
8688
8670
  var match = code.match(/sentry-dbid-([0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})/);
8689
8671
  if (match) {
@@ -8810,27 +8792,22 @@ function _prepareSourceMapForDebugIdUpload() {
8810
8792
  }
8811
8793
  _context13.prev = 21;
8812
8794
  _context13.next = 24;
8813
- return fs__default["default"].promises.mkdir(path__default["default"].dirname(targetPath), {
8814
- recursive: true
8815
- });
8816
- case 24:
8817
- _context13.next = 26;
8818
- return fs__default["default"].promises.writeFile(targetPath, JSON.stringify(map), {
8795
+ return util__namespace.promisify(fs__default["default"].writeFile)(targetPath, JSON.stringify(map), {
8819
8796
  encoding: "utf8"
8820
8797
  });
8821
- case 26:
8822
- _context13.next = 32;
8798
+ case 24:
8799
+ _context13.next = 30;
8823
8800
  break;
8824
- case 28:
8825
- _context13.prev = 28;
8801
+ case 26:
8802
+ _context13.prev = 26;
8826
8803
  _context13.t2 = _context13["catch"](21);
8827
8804
  logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath), _context13.t2);
8828
8805
  return _context13.abrupt("return");
8829
- case 32:
8806
+ case 30:
8830
8807
  case "end":
8831
8808
  return _context13.stop();
8832
8809
  }
8833
- }, _callee13, null, [[0, 6], [10, 16], [21, 28]]);
8810
+ }, _callee13, null, [[0, 6], [10, 16], [21, 26]]);
8834
8811
  }));
8835
8812
  return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
8836
8813
  }
@@ -9223,7 +9200,7 @@ function sentryUnpluginFactory(_ref) {
9223
9200
  });
9224
9201
 
9225
9202
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
9226
- process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.3");
9203
+ process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.4");
9227
9204
 
9228
9205
  /**
9229
9206
  * Handles errors caught and emitted in various areas of the plugin.