@absolutejs/beacon 0.6.5 → 0.6.7

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/index.d.ts CHANGED
@@ -302,7 +302,7 @@ export type BeaconSignals = {
302
302
  mediaFailures?: boolean;
303
303
  /** Time continuously waiting/stalled before reporting. Default 10000ms. */
304
304
  mediaStallMs?: number;
305
- /** Long-frame duration that counts as a main-thread stall. Default 200ms. */
305
+ /** Blocking duration that counts as a main-thread stall. Default 200ms. */
306
306
  mainThreadStallMs?: number;
307
307
  /** Stalls inside the window that trip a report. Default 3. */
308
308
  mainThreadStallCount?: number;
@@ -359,6 +359,11 @@ export type BeaconSignals = {
359
359
  /** Quiet period before an open, visible EventSource counts as stalled.
360
360
  * Default 60000ms. */
361
361
  stalledStreamMs?: number;
362
+ /** Endpoints that are quiet by design — push topics that only emit when
363
+ * something changes, so silence is health, not failure. Streams whose URL
364
+ * matches a string prefix or RegExp here are exempt from the
365
+ * stalled-stream signal (flap detection still applies). */
366
+ quietStreams?: Array<RegExp | string>;
362
367
  /** An `aria-busy`/`role="status"`/`role="progressbar"` element still
363
368
  * visible after `stuckLoadingMs` — a load that silently hung.
364
369
  * Default true. */
package/dist/index.js CHANGED
@@ -1335,7 +1335,9 @@ var createBeacon = (options) => {
1335
1335
  if (reported || document.visibilityState === "hidden")
1336
1336
  return;
1337
1337
  for (const entry of list.getEntries()) {
1338
- if (entry.duration < stallMs)
1338
+ const animationFrame = entry;
1339
+ const blockingDuration = entry.entryType === "long-animation-frame" && animationFrame.blockingDuration !== undefined ? animationFrame.blockingDuration : entry.duration;
1340
+ if (blockingDuration < stallMs)
1339
1341
  continue;
1340
1342
  const now = Date.now();
1341
1343
  stallTimes = stallTimes.filter((at) => now - at < stallWindowMs);
@@ -1343,7 +1345,6 @@ var createBeacon = (options) => {
1343
1345
  if (stallTimes.length < stallCount)
1344
1346
  continue;
1345
1347
  reported = true;
1346
- const animationFrame = entry;
1347
1348
  const script = [...animationFrame.scripts ?? []].sort((left, right) => (right.duration ?? 0) - (left.duration ?? 0))[0];
1348
1349
  emitSignal(`Main-thread stall — repeated long frames blocked the page — ${shortUrl(location.href)}`, {
1349
1350
  ...animationFrame.blockingDuration === undefined ? {} : {
@@ -2966,7 +2967,8 @@ var createBeacon = (options) => {
2966
2967
  const reportedStreams = new Set;
2967
2968
  const errorsByEndpoint = new Map;
2968
2969
  const reportedFlappingStreams = new Set;
2969
- const instrumentSource = (source, endpointLabel) => {
2970
+ const quietStream = (url) => (signals.quietStreams ?? []).some((pattern) => typeof pattern === "string" ? url.startsWith(pattern) || shortUrl(url).startsWith(pattern) : pattern.test(url));
2971
+ const instrumentSource = (source, endpointLabel, sourceUrl) => {
2970
2972
  let stallTimer;
2971
2973
  const disarm = () => {
2972
2974
  if (stallTimer !== undefined)
@@ -2975,6 +2977,8 @@ var createBeacon = (options) => {
2975
2977
  const check = () => {
2976
2978
  if (signals.stalledStreams === false)
2977
2979
  return;
2980
+ if (quietStream(sourceUrl))
2981
+ return;
2978
2982
  if (source.readyState !== OriginalEventSource.OPEN)
2979
2983
  return;
2980
2984
  if (document.visibilityState === "hidden") {
@@ -3040,7 +3044,7 @@ var createBeacon = (options) => {
3040
3044
  const wrappedEventSource = new Proxy(OriginalEventSource, {
3041
3045
  construct(target, args) {
3042
3046
  const source = Reflect.construct(target, args);
3043
- instrumentSource(source, shortUrl(String(args[0])));
3047
+ instrumentSource(source, shortUrl(String(args[0])), String(args[0]));
3044
3048
  return source;
3045
3049
  }
3046
3050
  });
@@ -3579,5 +3583,5 @@ export {
3579
3583
  BEACON_ATTRIBUTE
3580
3584
  };
3581
3585
 
3582
- //# debugId=BB4BB2A50E2A609E64756E2164756E21
3586
+ //# debugId=1C509449025A90CB64756E2164756E21
3583
3587
  //# sourceMappingURL=index.js.map