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