@mushi-mushi/core 1.32.0 → 1.32.2

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/README.md CHANGED
@@ -48,13 +48,13 @@ const resolved = expandPreset(config); // preset → nested options, explicit va
48
48
 
49
49
  ## Sampling and filters
50
50
 
51
- Sampling and URL filters apply to **automatic** error reports only, so a report a user sends from the widget is never sampled or filtered out. Only your own `beforeSend` can change or drop it.
51
+ Sampling applies to **automatic** error reports, and the error filters to automatic reports and `captureException()`. A report a user sends from the widget is never sampled or filtered out. Only your own `beforeSend` can change or drop it.
52
52
 
53
53
  | Field | Default | What it does |
54
54
  | --- | --- | --- |
55
55
  | `sampleRate` | `1` | Share of automatic error reports to send (`0`–`1`) |
56
56
  | `replaySampleRate` | `1` | Share of sessions that record replay |
57
- | `ignoreErrors` / `denyUrls` / `allowUrls` | — | Drop matching automatic captures |
57
+ | `ignoreErrors` / `denyUrls` / `allowUrls` | — | Drop matching errors from automatic capture and `captureException()`. URLs match the frame that threw |
58
58
  | `beforeSend` | — | `(report) => report \| null` for every report, after the PII scrubber. Return `null` to drop |
59
59
  | `tunnel` | — | Same-origin ingest path (e.g. `/api/mushi-tunnel`) so ad blockers don't drop reports |
60
60
 
package/dist/index.cjs CHANGED
@@ -169,8 +169,9 @@ function isPageUnloading() {
169
169
  // src/api-client.ts
170
170
  var lastOutbound = null;
171
171
  function flushLastOutboundOnUnload() {
172
- if (!lastOutbound) return false;
173
- return sendOnUnload(lastOutbound);
172
+ const outbound = lastOutbound;
173
+ lastOutbound = null;
174
+ return !!outbound && sendOnUnload(outbound);
174
175
  }
175
176
  var _credWarningEmitted = false;
176
177
  var MUSHI_USER_TOKEN_HEADER = "X-Mushi-User-Token";
@@ -252,8 +253,10 @@ function createApiClient(options) {
252
253
  ...extraHeaders
253
254
  };
254
255
  const serialized = body ? JSON.stringify(body) : void 0;
256
+ let outbound = null;
255
257
  if (serialized && method !== "GET" && internalKind !== "reporter-poll") {
256
- lastOutbound = { url, headers, body: serialized, path };
258
+ outbound = { url, headers, body: serialized, path };
259
+ lastOutbound = outbound;
257
260
  }
258
261
  try {
259
262
  const response = await fetch(url, {
@@ -323,6 +326,8 @@ function createApiClient(options) {
323
326
  message: error instanceof Error ? error.message : "Unknown network error"
324
327
  }
325
328
  };
329
+ } finally {
330
+ if (lastOutbound === outbound) lastOutbound = null;
326
331
  }
327
332
  }
328
333
  async function requestForReporter(method, path, reporterToken, body) {
@@ -620,6 +625,7 @@ function matchesErrorFilter(value, filters) {
620
625
  continue;
621
626
  }
622
627
  try {
628
+ filter.lastIndex = 0;
623
629
  if (filter.test(value)) return true;
624
630
  } catch {
625
631
  }