sentry-miniapp 1.2.0 → 1.3.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.
@@ -4936,7 +4936,7 @@ function addBreadcrumb(breadcrumb, hint) {
4936
4936
  }
4937
4937
  isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
4938
4938
  }
4939
- const SDK_VERSION = "1.2.0";
4939
+ const SDK_VERSION = "1.3.0";
4940
4940
  const SDK_NAME = "sentry.javascript.miniapp";
4941
4941
  const getSDK = () => {
4942
4942
  let currentSdk = {
@@ -6663,6 +6663,47 @@ let PerformanceIntegration = _PerformanceIntegration;
6663
6663
  const performanceIntegration = (options) => {
6664
6664
  return () => new PerformanceIntegration(options);
6665
6665
  };
6666
+ const _RewriteFrames = class _RewriteFrames {
6667
+ constructor(options = {}) {
6668
+ this.name = _RewriteFrames.id;
6669
+ this._prefix = options.prefix || "app:///";
6670
+ }
6671
+ /**
6672
+ * @inheritDoc
6673
+ */
6674
+ setupOnce() {
6675
+ }
6676
+ /**
6677
+ * @inheritDoc
6678
+ */
6679
+ processEvent(event) {
6680
+ if (event.exception && event.exception.values) {
6681
+ event.exception.values.forEach((exception) => {
6682
+ if (exception.stacktrace && exception.stacktrace.frames) {
6683
+ exception.stacktrace.frames.forEach((frame) => {
6684
+ if (frame.filename) {
6685
+ frame.filename = this._normalizeFilename(frame.filename);
6686
+ }
6687
+ });
6688
+ }
6689
+ });
6690
+ }
6691
+ return event;
6692
+ }
6693
+ /**
6694
+ * Normalizes a filename from various miniapp platforms
6695
+ */
6696
+ _normalizeFilename(filename) {
6697
+ let normalized = filename;
6698
+ normalized = normalized.replace(/^(appservice|app-service|WAService)\//i, "").replace(/^https?:\/\/[^/]+\//i, "").replace(/^[a-z]+:\/\//i, "").replace(/^\//, "");
6699
+ if (normalized.startsWith(this._prefix)) {
6700
+ return normalized;
6701
+ }
6702
+ return `${this._prefix}${normalized}`;
6703
+ }
6704
+ };
6705
+ _RewriteFrames.id = "RewriteFrames";
6706
+ let RewriteFrames = _RewriteFrames;
6666
6707
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6667
6708
  __proto__: null,
6668
6709
  Dedupe,
@@ -6670,6 +6711,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
6670
6711
  HttpContext,
6671
6712
  LinkedErrors,
6672
6713
  PerformanceIntegration,
6714
+ RewriteFrames,
6673
6715
  Router,
6674
6716
  System,
6675
6717
  TryCatch,
@@ -6705,6 +6747,9 @@ function init(options = {}) {
6705
6747
  stackParser: () => [],
6706
6748
  transport: options.transport
6707
6749
  });
6750
+ if (opts.enableSourceMap !== false) {
6751
+ opts.integrations.push(new RewriteFrames());
6752
+ }
6708
6753
  setContext("miniapp", {
6709
6754
  platform: appName,
6710
6755
  environment: "miniapp"